Computer Science
Assertion (A): The randint() method returns an integer from the specified range.
Reasoning (R): The syntax for randint() is: random.randint (start:stop)
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Python Modules
1 Like
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.
Answered By
1 Like
Related Questions
What will be the output of the following code:
>>> import statistics >>> statistics.mode([2, 5, 3, 2, 8, 3, 9, 4, 2, 5, 6])- 2
- 3
- 5
- 6
Assertion (A): The random module is a built-in module to generate pseudorandom variables.
Reasoning (R): The randrange() function is used to generate a random number between the specified range in its parameter.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): The function ceil() is a commonly used function from math module.
Reasoning (R): The ceil() function takes a numeric argument and returns the smallest integer that is greater than or equal to the argument.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Assertion (A): Some of the real-life applications of random module include CAPTCHA, OTP generation, automatic password generator and auto-filling, etc.
Reasoning (R): To import a random module, use:
import random from random import*- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.