Hello,
I would like to understand why you check if cur_node equals to True in your if statement.
It seems the code would work just fine with just:
if cur_node.data == key:
Thanks a lot
Best regards
Guillaume
def delete_node(self, key):
cur_node = self.head
if cur_node and cur_node.data == key:
self.head = cur_node.next
cur_node = None
return
Course: Data Structures and Algorithms in Python - Learn Interactively
Lesson: Deletion by Value - Data Structures and Algorithms in Python