Randomness
One great thing about programming is that we can simulate randomness, try the following code.
from random import randint
print(randint(0, 100))
The function randint() returns a random integer between the lower bound (0 in this case) and the upper bound (100 in this case).
Let’s set up our data as so….
from random import randint
grades = [randint(0, 100) for x in range(100)]
print(grades)
plt.hist() will allow us to plot a histogram.
plt.hist(grades)
plt.show()
We can have different numbers of bins by adding a bin=n argument.
plt.hist(grades,bins=30)
plt.show()
Source Code