Answers for "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."

0

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.

"""Hope It's usseful. Maybe I putted errors in the English phrases."""

"""The code adds -ing to a given word:
   --If the word already finishes with -ing it will change it to -ly.
   --If the word is less than 3 characters long it won't do anything."""

text=input("Writte the text")
if len(text)>=3:
	cutted_text=text[-3:]
	if not("ing" in cutted_text):
		if  not("ly" in cutted_text[:-2]):
			print("The word don't ends with -ing or -ly")
			text+="ing"
		else:
			print("The word already has -ly")
	else:
		print("The word ends width -ing")
		text=text[:-3]+"ly"
else:
	print("The word is less than 3 caracthers long")
		
print("")
print(text,"is the final result!")
input()
Posted by: Guest on May-07-2022

Code answers related to "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."

Python Answers by Framework

Browse Popular Code Answers by Language