0
class Node():
    next = None;
    def __init__(self,val):
        self.val = val
b = Node(1)
b = b.next = 2
print(b)

AttributeError: 'int' object has no attribute 'next'
    b = b.next = 2
Line 6 in <module> (Solution.py)

Why is this error occuring? Can anyone please explain me this.

0 Answers0