Question 1
Back to Exercise
What is the output of the following Python program?
print(list(range(5)), list(range(2, 10, 3)), list(range(10, 0, -4)))
- A [1, 2, 3, 4, 5] [2, 5, 8] [10, 6, 2]
- B [0, 1, 2, 3, 4] [2, 5, 8, 11] [10, 6, 2, -2]
- C [0, 1, 2, 3, 4] [2, 5, 8] [10, 6, 2] Correct
- D [0, 1, 2, 3, 4, 5] [2, 5, 8] [10, 6]
Correct Answer: Option C
The stop value is never included: 11 is past 10, and -2 is past 0 when counting down.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!