Hello everyone! I would like to ask you two questions regarding strings
which I do not know. Excuse me in advance if the questions may seem a bit
dumb. I'm a beginner. So let's get back to the point, this is my string:

msg= 'Hello world'
If I do, msg[:3] I get the following output, 'Hel'
If I do, msg[6:] I get the following output, 'World'
Ok, so I understand why this is happening. What I do not understand is why I
get the following output in this cases.


1) msg[:-1] which has the output 'Hello Worl'
2) msg[0:6:2]  'Hlo'
3) msg[::-1] 'dlroW olleH'

Can someone please explain this to me? Thank you so much and I wish everyone
a great day!
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to