-1

This is my code so far:

 lista = 'Text messaging, or texting, is the act of composing and sending electronic messages, typically consis'
 n = lista.split()
 m= ''

def adding(n):
for s in n:
    if s.endswith('ing'):
        s +='ly'
    else:
        s +='ing'
    return s
print(adding(n))

I should use .join somewhere, but I can't figure it out. Thank you!

1 Answers1

0

Actually you need to loop through n, the list you are taking in the function. Also make a new list for output. Here is an example:

def adding(lst):
    out = []
    for word in lst:
        if word.endswith("ing"):
            out.append(word+"ly")
        else:
            out.append(word+"ing")
     return out.join(" ")

print(adding(n()))
Nouman
  • 6,947
  • 7
  • 32
  • 60
  • Hi, I am not sure what you mean by that. This is my version, improvement would be to ignore punctuation. Don't know how yet.Check above for my edited version. – Lnx.Kernel.1 Oct 13 '18 at 20:32