Report Bug

Qus

What will be the output of the following Python code?

random.seed(3)  random.randint(1,5)  2  random.seed(3)  random.randint(1,5)
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. 3
B. 2
C. Any integer between 1 and 5, including 1 and 5
D. Any integer between 1 and 5, excluding 1 and 5


Solution
B. 2



Explanation
We use the seed function when we want to use the same random number once again in our program. Hence the output of the code shown above will be 2, since 2 was generated previously following which we used the seed function.
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