Remove element from list:

The remove() method finds the first instance of the element (passed an argument) and removes it from the list. Let's consider the following examples:

  • Example 1:
       >>> sequence = [1, 1, 2, 3, 4, 7, 5, 6, 7]
>>> sequence.remove(7)
>>> sequence
[1, 1, 2, 3, 4, 5, 6, 7]
  • Example 2:
       >>> sequence.remove(1)
>>> sequence
[1, 2, 3, 4, 5, 6, 7]
  • Example 3:
       >>> sequence.remove(1)
>>> sequence
[2, 3, 4, 5, 6, 7]