×
FREE ASSISTANCE FOR THE INQUISITIVE PEOPLE
Tutorial Topics
X
softetechnologies
String Example South point school assignment 16
String Examples - Python Language
1100    Arnab De    16/02/2021

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.
Sample String : 'abc'
Expected Result : 'abcing'
Sample String : 'string'
Expected Result : 'stringly'

softetechnologies
str1='hello'
length = len(str1)
if length > 2:
    if str1[-3:] == 'ing':
        str1 += 'ly'
    else:
        str1 += 'ing'
print(str1)
softetechnologies
String Example South point school assignment 16
softetechnologies
Author Details
Arnab De
I have over 16 years of experience working as an IT professional, ranging from teaching at my own institute to being a computer faculty at different leading institute across Kolkata. I also work as a web developer and designer, having worked for renowned companies and brand. Through tutorialathome, I wish to share my years of knowledge with the readers.
Enter New Comment
Comment History
No Comment Found Yet.
Sri Sri Ramakrishna Paramahamsa
The world is needed a mixture of truth and make-believe. Discard the make-believe and take the truth.
Sri Sri Ramakrishna Paramahamsa
775
44.84
Today So Far
Total View (Lakh)
softetechnologies
26/05/2018     36643
01/01/2018     34919
28/06/2017     32371
02/08/2017     30444
25/06/2018     30139
15/05/2017     25394
01/08/2017     24683
06/07/2017     24582
14/07/2017     20190
21/04/2018     19829
softetechnologies