How to reverse a string in Python using for loop?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to reverse a string in Python using for loop??

please make me understand ..

30th Sep 2018, 4:06 AM
Subhash Chaudhary
Subhash Chaudhary - avatar
4 Answers
+ 2
text = "string"; for x in reversed(text): print(x); #First define string, then use the reversed() function.
30th Sep 2018, 4:46 AM
Lance
Lance - avatar
+ 2
yep, I know that method and built in also
30th Sep 2018, 4:59 AM
Subhash Chaudhary
Subhash Chaudhary - avatar
+ 1
right Mr. Jay
30th Sep 2018, 4:56 AM
Subhash Chaudhary
Subhash Chaudhary - avatar
0
for i in reversed('speed'): print(i)
6th Oct 2018, 9:42 AM
sampreeth
sampreeth - avatar