What will be the output of the following Python code?
import random
random.choice(2,3,4)
An integer other than 2, 3 and 4
Either 2, 3 or 4
Error
3 only
random.choice([10.4, 56.99, 76])
Either 10.4, 56.99 or 76
Any number other than 10.4, 56.99 and 76
56.99 only
What will be the output of the following Python function (random module has already been imported)?
random.choice('sun')
sun
u
either s, u or n
error
What will be the output of the following Python function, assuming that the random module has already been imported?
random.uniform(3,4)
Either 3 or 4
Any integer other than 3 and 4
Any decimal value between 3 and 4
What will be the output of the following Python function if the random module has already been imported?
random.randint(3.5,7)
Any integer between 3.5 and 7, including 7
Any integer between 3.5 and 7, excluding 7
The integer closest to the mean of 3.5 and 7
seed
randomise
shuffle
uniform
random.seed(3) random.randint(1,5) 2 random.seed(3) random.randint(1,5)
3
2
Any integer between 1 and 5, including 1 and 5
Any integer between 1 and 5, excluding 1 and 5
(0,1)
(0,1]
[0,1]
[0,1)
random.randrange(0,91,5)
10
18
79
95
0
1
random.randrange(1,100,10)
32
67
91
80
What will be the output of the following Python function, assuming that the random library has already been included?
random.shuffle[1,2,24]
Randomized list containing the same numbers in any order
The same list, that is [1,2,24]
A list containing any random numbers between 1 and 24
True
None
2.3
none of the mentioned
range(3)
random.choice(range(0, 3))
random.shuffle(range(3))
random.select(range(3))
4
3.4
5
random.choice([3, 6])
random.randrange(3, 6)
3 + random.randrange(3)
3 + random.randrange(4)
(space)
,
KeyError: 1
do nothing, it is a placeholder for a function that is yet to be implemented
shuffle the elements of the list in-place