-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.py
More file actions
29 lines (24 loc) · 741 Bytes
/
Node.py
File metadata and controls
29 lines (24 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#Node class
class Node:
def __init__(self, type=None, cargo=None, next=None):
self.cargo = cargo
self.next = next
self.type = type
def __str__(self):
return str(self.cargo)
def set_value(self, t, c):
self.type = t
self.cargo = c
def append_a_node(self, new_node):
current_node = self
while current_node.next is not None:
current_node = current_node.next
current_node.next = new_node
# FAIL :(
def clearList(self):
current_node = self
while current_node is not None:
print(str(current_node))
place_node = current_node.next
del current_node
current_node = place_node