← Quiz: Queues and Microservices: all 10 questions
Quiz: Queues and Microservices · Question 8 of 10
What does this print? (code)
What does this print?
processed = set()
wallet = 0
for msg_id, amount in [("m1", 500), ("m2", 200), ("m1", 500)]:
if msg_id in processed:
continue
processed.add(msg_id)
wallet += amount
print(wallet)
- A.1200
- B.700
- C.500
- D.200
Answer & explanation
Correct answer: 700
The repeated m1 message is skipped, so only 500 + 200 is added.
Can you get the rest right without peeking?
Take the timed Quiz: Queues and Microservices quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →