E.T code coach help plz | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

E.T code coach help plz

Input Format: A string of a word in English. Output Format: A string of the reversed word that represents the original word translated into alien language. So I know I use the x.reverse() function but everything I try isn’t working, what am I doing wrong? I tried x=[input()] Print (x.reverse())

8th Feb 2022, 6:56 PM
Boar Bytes
Boar Bytes - avatar
2 Answers
+ 1
You are making a list with single value. Reversing it will same list. x.reverse() works on original list. So returns none. But what you need is reverse input string.. Your code, no way near to problem.. x = [2, 3,4] x.reverse() print(x) This is correct way buy on list.. String has no method of reverse() You can use slicing or a loop to reverse a string... Take string as just x = input() Then go on to reverse it.
8th Feb 2022, 7:04 PM
Jayakrishna 🇮🇳
0
# Hi! Here’s a way to use reversed(): print("".join(reversed("hello world")))
8th Feb 2022, 9:25 PM
Per Bratthammar
Per Bratthammar - avatar