← OCR GCSE

Random numbers: OCR GCSE practice

Using the random module. 7 questions in the style of the OCR GCSE exam.

Sample questions

After `import random`, which values can `random.randint(1, 6)` return?

  1. 1, 2, 3, 4 or 5
  2. Any whole number from 1 to 6 inclusive
  3. Any decimal number between 1 and 6
  4. 0, 1, 2, 3, 4, 5 or 6

In OCR Exam Reference Language, `roll = random(1, 6)`. Which value could NOT be stored in `roll`?

  1. 6
  2. 0
  3. 3
  4. 1