Report Bug

Qus

What will be the output of the following Python function, assuming that the random module has already been imported?

random.uniform(3,4)

Qusनिम्नलिखित Python फ़ंक्शन का आउटपुट क्या होगा, यह मानते हुए कि रैंडम मॉड्यूल पहले ही इम्पोर्ट किया जा चुका है?


A. Error
B. Either 3 or 4
C. Any integer other than 3 and 4
D. Any decimal value between 3 and 4


Solution
D. Any decimal value between 3 and 4



Explanation
This question depicts the basic difference between the functions random.randint(a, b) and random.uniform(a, b). While random.randint(a,b) generates an integer between ‘a’ and ‘b’, including ‘a’ and ‘b’, the function random.uniform(a,b) generates a decimal value between ‘a’ and ‘b’.
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