Delete all occurrences of an element in a list

In the public_files section of the problem statement, a class called PositionalList, which implements the Positional List ADT using a doubly-linked list, is defined. Extend the implementation of this class with a new public method delete_all(self, e). This method deletes all occurrences of element e in the list instance calling it.

For example, if t is an instance of the class PositionalList that represents the following list

1, 2, 3, 1, 1, 4, 1, 5, 6, 1

after executing the statement t.delete_all(1), the object t will represent the list

2, 3, 4, 5, 6

In particular, you should add the following public method to the PositionalList class:

  def delete_all(self, e):
    """ Deletes all occurrences of e in self. """

Problem information

Author: Josefina Sierra Santibáñez

Generation: 2026-01-25T13:52:46.147Z

© Jutge.org, 2006–2026.
https://jutge.org