0

In list problem.

word=list(input("enter your name : ")) def r_w(l): r=[] for i in l: r.append(i[::-1]) return r print(r_w(word))

15th Jul 2019, 6:07 AM
Shourov Saha
Shourov Saha - avatar
3 Respuestas
+ 1
whats the problem? if you want it to return the list as a whole replace the return statement with: return ‘’.join(r) if you want it to return a list with separated whole names in each element do: return ‘’.join(r).split(‘ ‘)
15th Jul 2019, 6:29 AM
Jake
Jake - avatar
+ 1
Your problem is at the "append"
18th Jul 2019, 11:02 PM
Mauricio De Martino
Mauricio De Martino - avatar
0
reverse the entire string and then append its elements word=list(input("enter your name : ")) def r_w(l): r = "" for i in l[::-1]: r += i return r print(r_w(word))
20th Jul 2019, 6:27 AM
Choe
Choe - avatar