Input = I have money, output= I evah yenom. How to build it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Input = I have money, output= I evah yenom. How to build it?

13th Oct 2019, 10:28 PM
Tatsu
Tatsu - avatar
10 Answers
0
https://code.sololearn.com/c4mKWxtLayZ9/?ref=app I have solution but I think its not effective
14th Oct 2019, 1:07 AM
Tatsu
Tatsu - avatar
+ 6
you are right, the code is still ineffective. Since you've tried i'm giving you a better solution. txt = "i have money" txt = txt.split() txt = [i[::-1] for i in txt] print(*txt)
14th Oct 2019, 1:18 AM
Shen Bapiro
Shen Bapiro - avatar
+ 3
split on whitespace, reverse chars in each word, build output string. how to do that in python is your job to learn.
13th Oct 2019, 11:31 PM
Nathan Stanley
Nathan Stanley - avatar
+ 3
Akash Pawar i think your code still have some bugs since the result turns into yenom evah i when it is supposed to be i evah yenom and using join after the list function wouldn't actually do anything, unless you do some list manipulation.
14th Oct 2019, 8:55 AM
Shen Bapiro
Shen Bapiro - avatar
+ 1
It very nice. thank you so much lvl 1 crook and every one
14th Oct 2019, 1:59 AM
Tatsu
Tatsu - avatar
+ 1
a = str(input("enter your name we will show reverse value : \n")) '''reverse the character which convert in lst''' a = list(reversed(a)) ''''join the list''' a = "".join(a) '''print join list it will show your reverae name''' print(a)
14th Oct 2019, 8:19 AM
Akash Pawar
Akash Pawar - avatar
0
Ok so you want reverse the code wait
14th Oct 2019, 8:57 AM
Akash Pawar
Akash Pawar - avatar
0
Split the the problem up into smaller pieces. For each word, separated by a space, reverse each word in place. Remember that strings are not able to be changed (but variables can be), so consider converting input to a list (which can be changed) if you're stuck. Topics that may be useful include the [] operator, for loops, index slicing, and string methods.
15th Oct 2019, 5:42 AM
Duck Typed
Duck Typed - avatar
0
Error 👆
15th Oct 2019, 10:47 PM
Tatsu
Tatsu - avatar
- 1
A = input(("enter sentence :")) A.reverse() print("reversed sentence is:"+A)
15th Oct 2019, 6:39 PM
Geetansh Verma
Geetansh Verma - avatar