Skip to content

Instantly share code, notes, and snippets.

@Mo-Shakib
Created July 17, 2021 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mo-Shakib/cc1e4f7780c2057388e28d96537c8548 to your computer and use it in GitHub Desktop.
Save Mo-Shakib/cc1e4f7780c2057388e28d96537c8548 to your computer and use it in GitHub Desktop.
Python - Removes all the elements from a linked list
def clear(self):
while (self.head is not None):
temp = self.head
self.head = self.head.next
temp = None
print('All the elements has been cleared!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment