Clean the Queue
Python
15 pts
Clean the Queue
Five people are waiting at a bank in Asmara. Change the list queue in this order:
- Yonas leaves: remove
"Yonas"by value. - The first person is served: take them out with
pop(0)and store them inserved. - The last person leaves: delete them with
del.
Print served and then queue. Expected output:
Selam ['Abel', 'Hana']
Checklist
- Remove
"Yonas"fromqueueby value. - Take the first person out with
pop(0)and store them inserved. - Delete the last person with
del, keeping the list itself. - Print
servedand thenqueue.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
