+ 1
Extra-terrestrials
#task: take a word as input, and output it backwards word=input() #makes a variable word=list(word) #converts word to a list drow=word.reverse() #makes another variable print(str(drow)) #converts drow to a string #unfortunately, it outputs None all the time. what’s wrong?
8 Respostas
+ 3
Trey ,
here some hints how the exercise can be done:
https://code.sololearn.com/cB69K21tN6kd/?ref=app
+ 6
.reverse() doesn't return anything. it updates what you call it on in place. so if you set it equal to a variable, as you have done with "drow" it will assign "None" to that variable
+ 1
Thanks, Lothar
0
Hmm, maybe that’s the case. So do I use the variable “word” throughout or something else?
0
If you want to keep your naming scheme, you could just replace the line:
drow = word.reverse()
with:
word.reverse()
drow = word
0
Okay, now what?
0
What is the goal of your code?
take a look at Lothar's Code
0
New Game ,
I saw this late by reading your profile.
I solved that Code Coach without variables using a slice.
print(input()[::-1])