Here's my code:
class Node:
def __init__(self, cargo=None, next=None):
self.cargo = cargo
self.next = next
class LinkedList:
def __init__(self):
self.first = None
self.last = None
# then I declare a list and a node
S = LinkedList()
cel = Node
cel = S.first
Now I want to put something in the list:
n = 0
x = 0
while n < 5:
x = input()
cel.val = x
cel = cel.next
Yet I get an error stating that:
'NoneType' object has no attribute 'val'
'NoneType' object has no attribute 'next'
Where is the problem?