Observe the following Python program carefully. Which of the following cannot…
2023
Observe the following Python program carefully. Which of the following cannot be the output of the following code?

- A.
433
- B.
413
- C.
354
- D.
643
Attempted by 1260 students.
Show answer & explanation
Correct answer: B
The function DICE(Low=1, High=6) generates a random integer between Low and High, inclusive, and prints it with end='', so the three values are displayed together without spaces. Call 1: DICE() can produce 1 to 6. Call 2: DICE(2) can produce 2 to 6. Call 3: DICE(2,4) can produce 2 to 4. In option B, 413 has second digit 1, but the second call cannot produce 1. Hence 413 cannot be the output.