On 12/06/17 15:57, Vikas YADAV wrote:
> for i in range(len(s)-1, 1, -2):
> print s[i]
> ---------------------------------------------
>
> So my question is: how would you write "s[::-1]" in terms of a for loop for
> illustration purpose?
Exactly as above but replace -2 with -1
for i in range(len(s)-1, 1, -1):
print s[i]
But that seems too obvious, am I missing something
subtle in your question?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor