Skip to content

Instantly share code, notes, and snippets.

@ishashankkumar
Created November 20, 2019 09:31
Show Gist options
  • Save ishashankkumar/429677863e9cc4b04997ae1c5ed8ff90 to your computer and use it in GitHub Desktop.
Save ishashankkumar/429677863e9cc4b04997ae1c5ed8ff90 to your computer and use it in GitHub Desktop.
>>> a = [1, 2, 3, 4, 2, 6, 7, 7] ##Initializaing a list
>>> a.remove(2) ##Should Remove first 2, should remove first 2.
>>> print a
[1, 3, 4, 2, 6, 7, 7]
>>> a.remove(5) . ### 5 is not part of list, should raise value error.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: list.remove(x): x not in list
>>> print a.remove(7) #### Returns None
None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment