The Waiting Room
Python
25 pts
The Waiting Room
Five people are waiting at a clinic in Asmara.
- Loop through the list
servedand take each person out ofwaiting. Some names in the list are not waiting (or appear twice), so choose the method that does not crash. - Print the number of people still waiting.
- Call the next person with
pop()and store the name innext_person. Print the number still waiting. - The clinic closes: empty
waitingwithclear()and print it.
Expected output:
3 2 set()
Checklist
- Keep
servedunchanged. Loop through it and take each person out ofwaitingwithout crashing. - Call the next person with
pop()and store the name innext_person. - Empty
waitingwithclear(). - Print the number waiting after the loop and after
pop(), then the empty set.
🔑 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.
