Created
June 19, 2022 02:34
-
-
Save wanderindev/4053286811950aa269caad2e0d699e39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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