Python 3 How do i fix TypeError: __init__() missing 1 required positionalargument: 'next' on head1=tall=Node(i). class Node(object):
Question:
Python 3
How do i fix TypeError: __init__() missing 1 required positionalargument: 'next' on head1=tall=Node(i).
class Node(object):
item = -1
next = None
def __init__(self,item,next):
self.item = item
self.next = next
def merge_lists(vivendi, activision):
head = tail = Node(0)
while vivendi and activision:
if vivendi.item
tail.next = vivendi
vivendi = vivendi.next
else:
tail.next = activision
activision = activision.next
tail =tail.next
tail.next = vivendi or activision
return head.next
def printRepeating(mergeLists,size):
print("Repeating ID's are ", end = '')
for i in range(0, size):
for j in range(i+1,size):
if mergeLists[i]==mergeLists[j]:
print(mergeLists[i],"", end = '')
if __name__ =='__main__':
vivendi = []
with open('vivendi.txt', 'r') as myfile:
for line inmyfile:
vivendi.append(int(line.strip()))
#print(vivendi)
head1=tall=None;
for i in vivendi:
if(head1==None):
head1=tall=Node(i)
else:
tall.next=Node(i)
tall=tall.next
activision = []
with open('activision.txt', 'r') asmyfile:
for line inmyfile:
activision.append(int(line.strip()))
#print(activision)
head2=tall2=None;
for i in activision:
if(head2==None):
head2=tall2=Node(i)
else:
tall2.next=Node(i)
tall2=tall2.next
new_head=merge_lists(head1,head2)
mergeLists = []
count = 0
while new_head:
mergeLists.append(new_head.val)
new_head=new_head.next
count=count+1
printRepeating(mergeLists,count)
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill