Sep-22-2019, 02:01 AM
You are misunderstanding indexes. Think of the indexes as being between the items, rather than on the items:
Output:lunch = ['Spam', 'spam', 'spam', 'eggs', 'spam']
^ ^ ^ ^ ^ ^
| | | | | |
0 1 2 3 4 5
-5 -4 -3 -2 -1
If you just give one index, you get the item after it. But if you give two indexes, you get everything between them. So lunch[0:5] is five items, not six.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures