CBSE Class 11 Computer Science Question 2 of 63

Introduction to Python Modules — Question 2

Back to all questions
2
Question

Question 2

Assertion (A): The randint() method returns an integer from the specified range.

Reasoning (R): The syntax for randint() is: random.randint (start:stop)

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.
Answer

A is true but R is false.

Explanation
The randint() method generates a random integer number from the specified range. The syntax for randint() is random.randint(a, b), where a is the lower bound and b is the upper bound.