Skip to content

Instantly share code, notes, and snippets.

@wanderindev
Created June 19, 2022 02:34
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 wanderindev/4053286811950aa269caad2e0d699e39 to your computer and use it in GitHub Desktop.
Save wanderindev/4053286811950aa269caad2e0d699e39 to your computer and use it in GitHub Desktop.
def pop(self) -> Union[Any, None]:
"""Return and remove the node at the front of the linked list"""
if self.is_empty():
return None
node_to_pop = self.head
self.head = self.head.next_node
return node_to_pop.data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment