logo

Question detail

Consider this Python code: import random; value = random.randint(1, 3). Which statement is correct?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

Consider this Python code: import random; value = random.randint(1, 3). Which statement is correct?.

  1. A.value can be 1, 2 or 3.
  2. B.value can be 1 or 2, but not 3.
  3. C.value can be 0, 1, 2 or 3.
  4. 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.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.