MCPcopy
hub / github.com/jwasham/practice-python / delete

Method delete

linked_lists/linked_list.py:46–57  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

44
45 # Deletes all instances of given value in list.
46 def delete(self, value):
47 current = self.head_
48 prev = None
49 while current:
50 if current.get_data() == value:
51 if prev:
52 prev.set_next(current.get_next())
53 else:
54 self.head_ = current.get_next()
55 else
56 prev = current
57 current = current.get_next()
58
59 # Pushes an item on the front of the list.
60 def push(self, value):

Callers 2

mainFunction · 0.95
mainFunction · 0.80

Calls 3

get_dataMethod · 0.80
set_nextMethod · 0.80
get_nextMethod · 0.80

Tested by

no test coverage detected