Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
Created February 14, 2012 10:09
Show Gist options
  • Save JakubOboza/1825484 to your computer and use it in GitHub Desktop.
Save JakubOboza/1825484 to your computer and use it in GitHub Desktop.
Python 2.7.2 (default, Jan 23 2012, 23:13:33)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.10.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ar = [1,2,3]
>>> ar
[1, 2, 3]
>>> ar[:-1]
[1, 2]
>>> ar[-1]
3
>>> ar[-10]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
>>> ar[-2]
2
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment