Computer Science
To include the use of functions which are present in the random library, we must use the option:
- import random
- random.h
- import.random
- random.random
Python Modules
3 Likes
Answer
import random
Reason — To use functions from the random library in Python, we must include the line import random at the beginning of code.
Answered By
3 Likes
Related Questions
On executing the following code, what output will be displayed?
statistics.mode([2.5, 3.2, 3.3, 2.5, 8.1, 9.9, 2.5, 5.1])
- 2.5
- 3.2
- 5.1
- 8.1
What will the following code display on execution?
X = statistics.mean([2, 15, 6, 19])
- 10.5
- 10.6
- Error
- None of these
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.