Created
April 19, 2022 08:26
-
-
Save jamilnoyda/a9362e2da5d54a6404a4c85289d5770e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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