Reverse string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Reverse string

I/p="disk drive" o/p='ksid evird'

8th Dec 2018, 12:38 PM
Madhavarao
5 Answers
+ 2
sentence="Disk Drive".split() for i in sentence: print(i[::-1], end=" ")
8th Dec 2018, 12:50 PM
LordHill
LordHill - avatar
0
please give me the code
8th Dec 2018, 12:39 PM
Madhavarao
0
I will works but the o/p like this"evird ksid" but required answer is" ksid evird"
8th Dec 2018, 12:44 PM
Madhavarao
0
kk it will works tq
8th Dec 2018, 12:58 PM
Madhavarao
0
Hey Try this code given below def spell(txt): for i in txt: return txt[::-1] txt = input() print(spell(txt)) it will iterate over the complete string to show result
27th Jul 2022, 7:22 PM
Haroon Rasheed
Haroon Rasheed - avatar