Queue Initialization | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Queue Initialization

Why is item not recognized? https://code.sololearn.com/c371h9jv0KJv/?ref=app

4th Oct 2022, 4:07 AM
Sanjay Kamath
Sanjay Kamath - avatar
2 Answers
+ 1
c.add(n) is not inside the scope of the input loop so it never adds anything. item = c.next() is inside of the if c.is_empty(): condition check so no item is ever dequeued.
4th Oct 2022, 5:56 AM
Odyel
Odyel - avatar
0
Odyel It worked!!!!!! Gr8
4th Oct 2022, 9:33 AM
Sanjay Kamath
Sanjay Kamath - avatar