COMPLETE THIS PYTHON PROGRAM BY FILLING OUT FOLLOWING BLANKS AND ALSO ATTACH OUTPUT
PLEASE COMPLETE THIS PYTHON PROGRAM BY FILLING OUT FOLLOWING BLANKS AND ALSO ATTACH OUTPUT:
class ________:
# Singly linked node
def __init__(self, data=None, next=None, prev=None):
self.data = data
self.next = next
self.prev = prev
class doubly_linked_list(object):
def __init__(self):
self.head = None
self.tail = None
self.count = 0
def append_item________:
# Append an item
new_item = _____________
if self.head is None:
self.head = new_item
self.tail = self.head
else:
new_item.prev = _______
self.tail.next = new_item
self.tail = new_item
self.count += 1
def iter(self):
# Iterate the list
current = _______
while current:
item_val = current.data
current = current.next
yield item_val
def print_foward(self):
for node in self.iter():
print(node)
def search_item(self, val):
for node in _________:
if val == node:
return True
return False
items = ____________
items.append_item('PHP')
items.append_item('Python')
items.append_item('C#')
items.append_item('C++')
items.append_item('Java')
items.append_item('SQL')
print___________
items.print_foward()
print("\n")
if items.search_item('SQL'):
print("True")
else:
print("False")
if items.___________
print("True")
else:
print("False")

Step by step
Solved in 2 steps with 1 images









