# Python Tutorial – Reverse a String Using for loop

///Python Tutorial – Reverse a String Using for loop

## Python Tutorial – Reverse a String Using for loop

In this Python Programming video tutorial you will learn how to reverse given string .

Here in this video tutorial we will learn how to reverse a string using for loop and function in detail with example.

For more free tutorials on computer programming

source

By |2019-05-21T19:13:59+00:00May 21st, 2019|Python Video Tutorials|32 Comments

1. kavya kalshetty May 21, 2019 at 7:14 pm - Reply

thank you very much ma'am ……very easy way of explanation u had given here…..thanks a lot ๐
looking many more python videos from you

2. Praveen Tiwari May 21, 2019 at 7:14 pm - Reply

thanks for explaining everything clearly ………thanks a lot……..

3. Mohamed .Bakr May 21, 2019 at 7:14 pm - Reply

Thanks from Egypt

4. Manpreet Sarna May 21, 2019 at 7:14 pm - Reply

thanks for the help
helped me lot

5. Ultimate Cricket Videos May 21, 2019 at 7:14 pm - Reply

6. jumanjiwarlord May 21, 2019 at 7:14 pm - Reply

Letโs say the word is Dog. On the first iteration, the D is stored in the empty list. Now on the second iteration, we pick up the o. And we add the o to the list… the list already contains D but the second iteration will be added BEFORE the list. Now we have oD… and so forth… goD.

The trick is in the concatenation. i + reversed_string is like o + D. Itโs only confusing because we read left to right and this logic is going against our natural tendencies. We just canโt grasp that o being placed BEFORE the D in a concatenated string unless you understand concatenation (and building strings through concatenation).

I hope this helps somebody. Weโre all at different levels. Some people have mentioned the [::-1] technique. Splicing a list, I believe itโs called? Thatโs probably the easier way.

7. amitabh gupta May 21, 2019 at 7:14 pm - Reply

You are very good and your way is best,keep it up

8. Ralph Machado May 21, 2019 at 7:14 pm - Reply

hi i learn a lot from your videos and check my below code which is more simply than the above one.
print("enter anything to be reversed")

x=input()

length=len(x)

for i in range(length-1,-1,-1):

print(x[i],end="")

9. jitendra navagire May 21, 2019 at 7:14 pm - Reply

very good explanation

10. jitendra navagire May 21, 2019 at 7:14 pm - Reply

thank you so much.. these is very helpful to me .

11. pranav fuggu May 21, 2019 at 7:14 pm - Reply

We can do this usnig list bcoz usnig def its very long process as u done in vdo

12. pavan boggarapu May 21, 2019 at 7:14 pm - Reply

way of explanation is too good thank you soo much

13. Mcbere May 21, 2019 at 7:14 pm - Reply

Thank you again for another well explained tutorial. Itโs not just the method you used to solve the problem but I have gained a better understanding with FOR LOOP watching this video. Youโre a great teacher. I am waiting for your next video. Thank you

14. Harikrushna Sabat May 21, 2019 at 7:14 pm - Reply

Hello Ma'am,I have started watching your Python programming videos and the sessions were really helpful as you did explained in a nicely manner.

Is it possible to navigate all your videos (the concepts + sample program's) please?

Also,let me know if any materials are available and then I can take as well if they are chargable?

15. Hari Krishna May 21, 2019 at 7:14 pm - Reply

nice explain

16. Hari Krishna May 21, 2019 at 7:14 pm - Reply

print(str(input())[::-1])

17. kapish Singh May 21, 2019 at 7:14 pm - Reply

def reverse(y):
for i in range (1,1+len(y)):
print(y[-i],end='')

reverse("amulse")

18. Brandon Zabriskie May 21, 2019 at 7:14 pm - Reply

I entered the same code into python and when I run it there's no output, just says finished with exit code 0. Does anyone know why this is?

19. Vengatesh Prasath May 21, 2019 at 7:14 pm - Reply

I want a tutorial…. tree using python… Like binary tree, linear tree, search tree,

20. riuspablo May 21, 2019 at 7:14 pm - Reply

Or

>>> string = "amuls"
>>> string[::-1]

21. Disha Dubey May 21, 2019 at 7:14 pm - Reply

Isme formula to laga nhi

22. Naveen chandra Adhikari May 21, 2019 at 7:14 pm - Reply

can ypu made a bubble sort program by using increament

23. Uday May 21, 2019 at 7:14 pm - Reply

n =("amuls")
n1=(n[::-1])
print(n1)

24. SAMBHAV SISODIA May 21, 2019 at 7:14 pm - Reply

l,m,n = yell,yem,yen ๐๐๐ ,whatever video was great !

25. Tech & News May 21, 2019 at 7:14 pm - Reply

Nice explanation.. Thanks..

26. Shruthi Ranganathan May 21, 2019 at 7:14 pm - Reply

Fabulous keep going i loved u programmes vry helpful especially during exams๐๐๐๐๐๐๐๐

27. Nishant Singh May 21, 2019 at 7:14 pm - Reply

wrd=input("Please enter a word")
wrd=str(wrd)
rvs=wrd[::-1]
print(rvs)
if wrd == rvs:
print("This word is a palindrome")
else:
print("This word is not a palindrome")
"could you explain this"

28. chandrashekhar patil May 21, 2019 at 7:14 pm - Reply

Nice explanation

29. Youssef El-Shabasy May 21, 2019 at 7:14 pm - Reply

nice

30. comedy mashup May 21, 2019 at 7:14 pm - Reply

Thanks mam

31. Mohit Sharma May 21, 2019 at 7:14 pm - Reply

I got it…!!!
thanks

32. Siva Shankar May 21, 2019 at 7:14 pm - Reply

Thank mam