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))
3 odpowiedzi
+ 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(‘ ‘)
+ 1
Your problem is at the "append"
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))