Exam-style question
Try this first
Consider this Python code: import random; value = random.randint(1, 3). Which statement is correct?.
- A.value can be 1, 2 or 3.
- B.value can be 1 or 2, but not 3.
- C.value can be 0, 1, 2 or 3.
- D.value is always 2.
Model answer
What a good answer should say
- value can be 1, 2 or 3.
Explanation
Why this works
Both limits passed to randint are included, so the possible values are 1, 2 and 3.
Common mistake
No common mistake is linked to this question yet.
