On 29 Jan 2018, at 7:42, vinod bhaskaran wrote:
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.
You don't need that, think about this example
newstring = ''
oldstring = "Newton"
now you go through each char in oldstring, so you get first N which you
add to newstring and you get
newstring = 'N'
next char is 'e' and then you do 'e' + 'N' and get 'eN'
newstring = 'eN'
next char the same way
newstring = 'weN'
etc
until you get 'notweN'
Remember that the for-loop will step through each char in oldstring so
when you come to the end the loop will stop.
= jem
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor