I need to take an word(string) as an input and print the word backwards | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need to take an word(string) as an input and print the word backwards

Eg:input:bad Output:dab This is the code I've written x=str(input("Enter a word :")) print(x) i=len(x)-1 for i in range(len(x)): print(x[i]) i-=1 Is my logic correct because I'm not getting the output

30th Mar 2020, 7:57 AM
Karthik Eyan
4 Answers
+ 2
Could you give me an up vote.... just asking
30th Mar 2020, 8:09 AM
Aditi Mishra
Aditi Mishra - avatar
+ 1
I think this code will reverse the order of words in a sentence rather than printing the word backwards
30th Mar 2020, 8:04 AM
Aditi Mishra
Aditi Mishra - avatar
0
Thank you for you're help
30th Mar 2020, 8:08 AM
Karthik Eyan