Which values can random.randint(1, 6) return?
Correct answer D. Any integer from 1 to 6, including both 1 and 6
Explanation
random.randint(a, b) returns an integer N with a <= N <= b, so both end points are included. This differs from range() and random.randrange(), which exclude the stop value. randint(1, 6) is therefore a fair way to simulate a six-sided die.
Answer checked How we write and check questions
Discussion