Which of the following statements is false?
A) Function randrange actually generates pseudorandom numbers, based on an internal calculation that begins with a numeric value known as a seed.
B) When you're debugging logic errors in programs that use randomly generated data, it can be helpful to use the same sequence of random numbers until you've eliminated the logic errors, before testing the program with other values.
C) You can use the random module's seed function to seed the random-number generator yourself-this forces randrange to begin calculating its pseudorandom number sequence from the seed you specify. Choosing the same seed will cause the random number generator to generate the same sequence of random numbers.
D) In the following session, snippets [2] and [5] produce the same results purely by coincidence: In [1]: import random
In [2]: random.seed(32)
In [3]: for roll in range(10) :
) ..: print(random.randrange(1, 7) , end=' ')
) ..:
1 2 2 3 6 2 4 1 6 1
In [4] for roll in range(10) :
) ..: print(random.randrange(1, 7) , end=' ')
) ..:
1 3 5 3 1 5 6 4 3 5
In [5] random.seed(32)
In [6]: for roll in range(10) :
) ..: print(random.randrange(1, 7) , end=' ')
) ..:
1 2 2 3 6 2 4 1 6 1
Correct Answer:
Verified
Q4: Which of the following statements is false?
A)
Q5: Which of the following statements a), b)
Q6: Which of the following statements is false?
A)
Q7: Which of the following statements a), b)
Q8: Which of the following statements is false?
A)
Q10: Which of the following statements is false?
A)
Q11: Assuming the following function definition, which of
Q12: Which of the following statements is false?
A)
Q13: Which of the following statements is false?
A)
Q14: Which of the following statements is false?
A)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents