Question: This is PYTHON!!!! Part B: random Module functions If we import random, some of the useful function are: General Syntax Description Example random.randrange(start,stop[,step]) Choose a
This is PYTHON!!!!
Part B: random Module functions
If we import random, some of the useful function are:
| General Syntax | Description | Example |
| random.randrange(start,stop[,step]) | Choose a random item from range(start, stop[, step]). | random.randrange(0,110,10) |
| random.randint(a, b) | Return random integer in [a, b], including both ends | random.randint(a, b) |
| random.random( ) | Return a value in the range [0,1). | random.random( ) |
Suppose we wanted to randomly roll a 6-sided die to get a value between 1 and 6. How would you use each of the above to generate a die value between 1 and 6?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
