We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91c0f18 commit 2d39927Copy full SHA for 2d39927
Lab Cycle 2/program16.py
@@ -0,0 +1,14 @@
1
+# Program to Add ‘ing’ at the end of a given string.
2
+# If it already ends with ‘ing’, then add ‘ly’
3
+
4
+# Function to add 'ing'/'ly' at the end of a given string
5
+def add_ing(str):
6
+ if str[-3:] == 'ing': # if the last three characters are 'ing'
7
+ return str + 'ly' # add 'ly' to the end of the string
8
+ else:
9
+ return str + 'ing' # add 'ing' to the end of the string
10
11
+print("Enter a string: ")
12
+str = input()
13
+print("The string is ",str)
14
+print("The string after adding 'ing'/'ly' is: ", add_ing(str)) # call the function
0 commit comments