Created
November 20, 2019 09:52
-
-
Save ishashankkumar/81f22f6969b285d38b0fee2acf71acc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> a = [1, 2, 3, 4, 2, 6, 7] # Initailized a list | |
>>> a.pop() # Removes the element at index -1(i.e. at last place) | |
7 | |
>>> print a | |
[1, 2, 3, 4, 2, 6] | |
>>> a.pop(4) # Removes the element at index 4 | |
2 | |
>>> print a | |
[1, 2, 3, 4, 6] | |
>>> a.pop(100) # Index out of range. | |
IndexError: pop index out of range |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment