Skip to content

Instantly share code, notes, and snippets.

@jamilnoyda
Created April 19, 2022 08:26
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 jamilnoyda/a9362e2da5d54a6404a4c85289d5770e to your computer and use it in GitHub Desktop.
Save jamilnoyda/a9362e2da5d54a6404a4c85289d5770e to your computer and use it in GitHub Desktop.
class Node:
def __init__(self, value) -> None:
self.value = value
self.next = None
class SingleList:
def __init__(self) -> None:
self.head = None
def print_list(self):
print_value = self.head
while print_value is not None:
print(print_value.value)
print_value = print_value.next
node_a = Node("a")
node_b = Node("b")
node_c = Node("c")
s_list = SingleList()
s_list.head = node_a
s_list.head.next = node_b
node_b.next = node_c
print(s_list.print_list())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment