Skip to content

Instantly share code, notes, and snippets.

@ishashankkumar
Created November 20, 2019 09:52
Show Gist options
  • Save ishashankkumar/81f22f6969b285d38b0fee2acf71acc2 to your computer and use it in GitHub Desktop.
Save ishashankkumar/81f22f6969b285d38b0fee2acf71acc2 to your computer and use it in GitHub Desktop.
>>> 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