Skip to content

Instantly share code, notes, and snippets.

@niranjrajasekaran
Created August 1, 2019 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niranjrajasekaran/f9d44bb0d3090400677cdbb6104fb134 to your computer and use it in GitHub Desktop.
Save niranjrajasekaran/f9d44bb0d3090400677cdbb6104fb134 to your computer and use it in GitHub Desktop.
In [1]: l = [10, 'python-list', 1, 2, 3, 4, 5, [1, 2, 3, 4, 5]]
In [2]: l
Out[2]: [10, 'python-list', 1, 2, 3, 4, 5, [1, 2, 3, 4, 5]]
In [3]: l[0]
Out[3]: 10
In [4]: l[1]
Out[4]: 'python-list'
In [5]: l[-1]
Out[5]: [1, 2, 3, 4, 5]
In [6]: l[100]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-6-e2a0c2623844> in <module>()
----> 1 l[100]
IndexError: list index out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment