Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

ing or ly add to str

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'))
Source by codereview.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #ing #ly #add #str
ADD COMMENT
Topic
Name
7+4 =