Please answer if you can match the exact
output.
Please post the codes in *PYTHON* the question is given
in the image and the pre-posted code is given in picture and
text .Please use that structure to code the rest and follow
the instructions of the question Follow the instructions of the
question exactly as it says and the output must match as per given
in the image's result section. Also please post the answer codes in
*TEXT *, not *Image* also show an output picture.
Please make sure there is no indentation and syntax
error.
class Node:
#{
def __init__(self, datum, next):
#}
class MyDigitQueue:
#{
def __init__(self):
def front(self):
def enqueue(self, item):
def dequeue(self):
#}
Please match the output exactly it is a requirement.
Study the examples below carefully and implement a class called MyDigitQueue that allows adding only digits (0-9) to the queue. Any other numbers that are not a digit when added to the queue will be ignored. For example: Test Result queueObj = MyDigitQueue ( ) 7 7 7 None # enqueue () add item to the queue queueObj.enqueue (23) # ignored queueObj.enqueue (7) queueObj.enqueue (-10) # ignored # front) get front item of the queue print(queueObj. front()) print(queueObj. front()) # dequeue () remove item from queue print(queueObj.dequeue()) print(queueObj.dequeue()) queueObj = MyDigitQueue () 0 # enqueue() add item to the queue queueObj.enqueue (0) queueObj.enqueue (17) # ignored queueObj.enqueue(-1) # ignored queueObj.enqueue (9) 0 0 9 None # front) get front item of the queue print (queueObj.front()) print(queueObj. front()) # dequeue () remove item from queue print(queueObj.dequeue()) print(queueObj.dequeue()) print (queueObj.dequeue())
1 class Node: 2#{ 3 def __init__(self, datum, next): 4 #} 5 6v class MyDigitQueue: 7 #{ 8 def __init__(self): 9 10 def front(self): 11 def enqueue(self, item): 13 def dequeue(self): 15 #} 12 14
Please answer if you can match the exact output. Please post the codes in *PYTHON* the question is given in the image an
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am