Blog Archive

search

Tuesday, August 6, 2019

Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged

a = input('Enter a string ')
b = a[-3:]
if(a[-3:] == 'ing'):
    b = a +'ly'
elif(len(b) <3):
    print(b)
else:
    b =a+'ing'
print(b)

No comments:

Post a Comment

Python program to create a string from two given strings concatenating uncommon characters of the said strings

PROGRAM :  a = input('Enter a string : ') b = input('Enter a string : ') c='' for i in a:     if(i not in b):...