Report Bug

Qus

What will be the output of the following Python code?

import random

random.choice([10.4, 56.99, 76])

Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. Error
B. Either 10.4, 56.99 or 76
C. Any number other than 10.4, 56.99 and 76
D. 56.99 only


Solution
B. Either 10.4, 56.99 or 76



Explanation
The function random.choice(a,b,c,d) returns a random number which is selected from a, b, c and d. The output can be either a, b, c or d. Hence the output of the snippet of code shown above can be either 10.4, 56.99 or 76.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad