+ 1
Input = I have money, output= I evah yenom. How to build it?
10 Respostas
0
https://code.sololearn.com/c4mKWxtLayZ9/?ref=app
I have solution but I think its not effective
+ 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)
+ 3
split on whitespace, reverse chars in each word, build output string.
how to do that in python is your job to learn.
+ 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.
+ 1
It very nice.
thank you so much lvl 1 crook and every one
+ 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)
0
Ok so you want reverse the code wait
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.
0
Error 👆
- 1
A = input(("enter sentence :"))
A.reverse()
print("reversed sentence is:"+A)