Hi,

I am a new beginner in programming.
I saw a code (given below) to reverse  string.

newstring = ''
oldstring = 'Newton'
for char in oldstring:
   newstring = char + newstring
print(newstring)



Could someone explain how it is traversing to get the string reversed?

As the new character is adding the char in the new string but how is it
getting reversed without any line giving the char number to be traversed in
reverse order.

Thanks,
Vinod
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to