Computer Science, asked by tanya2456, 11 months ago

Write a program to input a sentence and display the following 1) no of words starting with"ab" 2) no of words ending with"ing"

Answers

Answered by Anonymous
1

Answer:

Python Code

def add_string(str1):

 length = len(str1)

 if length > 2:

   if str1[-3:] == 'ing':

     str1 += 'ly'

   else:

     str1 += 'ing'

 return str1

print(add_string('ab'))

print(add_string('abc'))

print(add_string('string'))

Output

ab                                                                                                            

abcing                                                                                                        

stringly

Hope It Might Help You

Regards BhamBhamBhole ;)

Similar questions