python pylab
A histogram is a plot which shows the distribution of values in a set of data. The values are sorted first and then divided into classes/group of equal size.
直方图是显示一组数据中值的分布的图。 首先对值进行排序,然后将其分为大小相等的类/组。
So, in this article, we are going to use hist() function to plot the histogram of the sum of randomly generated numbers.
因此,在本文中,我们将使用hist()函数绘制随机生成的数字之和的直方图。
The function pylab.hist(vals, bin = 10) produces a histogram with 10 equally sized groups and the frequency of result in those classes.
函数pylab.hist(vals,bin = 10)生成一个直方图,其中包含10个大小相等的组,以及这些类中结果的频率。
So here is the code:
所以这是代码:
import random
import pylab
val = []
for n in range(1004):
x = random.choice(range(0,90))
y = ran