← Quiz: Reliability Patterns: all 10 questions
Quiz: Reliability Patterns · Question 3 of 10
What does this print? (code)
What does this print?
delays = [min(8, 0.5 * 2 ** a) for a in range(6)]
print(delays)
- A.[0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
- B.[0.5, 1.0, 2.0, 4.0, 8.0, 16.0]
- C.[0.5, 1.0, 2.0, 4.0, 8, 8]
- D.[1, 2, 4, 8, 8, 8]
Answer & explanation
Correct answer: [0.5, 1.0, 2.0, 4.0, 8, 8]
The delay doubles each time and is capped at 8. Python prints the cap as 8 because min returned the integer.
Can you get the rest right without peeking?
Take the timed Quiz: Reliability Patterns quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →