Question: Python contains a random number generator that is implemented by first importing the random module and then calling the method randrange() to generate a random
Python contains a random number generator that is implemented by first importing the random module and then calling the method randrange() to generate a random number. Input the following code: import random print (random.randrange(5)) Execute the print statement several times. Put the print line in a loop to print a random value at least 20 times and record your results. What range of numbers does the print statement produce? If you wanted to randomly generate the numbers from 1 to 5 what code would you have to add to the above print statement to do this? What would you change to get a random number in the range 1-100?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
