random function Quiz 1

Share with others

Enter details and click on Next

Email
Q1. Write the output of the following code :


import random

for i in range(random.randint(2,2)):
         print(i)

Q2. Write the output of the following code :


import random

for i in range(random.randint(2,3)):
         print("A")

Q3. What is the minimum and maximum value of 'A' in the following statement..

import random
A=random.randint(2,30)
print(A)

Q4. Write the output of the following code :

import random
A=random.randrange(20)
print(A)

Q5. Write the output of the following code :

import random
print(int(random.random()))

Q6. Write the output of the following code :

import random
print(int(random.random()*5))

Q7. Which of the following subject will never printed in following code?


import random

L=["English","Hindi","Math","Science","SST","CS","IP"]
for i in range(random.randint(1,6)):
       print(L[i])

Q8. What is the minimum and maximum value of 'v' in the following statement.

import random
v=random.randrange(20)-3
print(v)

Q9. Which of the following method is not included in random module?

Q10. A = random.______([1,2,3,4,5])

Value of A can be 1 to 5(including both)


Share with others

Leave a Reply