Question: In the previous exercise, you used rand ( ) , that generates a random float between 0 and 1 . As Hugo explained in the

In the previous exercise, you used rand(), that generates a random float between 0 and 1.
As Hugo explained in the video you can just as well use randint(), also a function of the random package, to generate integers randomly. The following call generates the integer 4,5,6 or 7 randomly. 8 is not included.
import numpy as np
np.random.randint(4,8)
NumPy has already been imported as np and a seed has been set. Can you roll some dice?
Instructions
100 XP
Use randint() with the appropriate arguments to randomly generate the integer 1,2,3,4,5 or 6. This simulates a dice. Print it out.
Repeat the outcome to see if the second throw is different. Again, print out the result.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!