Screen Link: Learn data science with Python and R projects

My Code:

```
import numpy as np
chi_squared_values = []
for i in range(1000):
randos = np.random.random(32561)
expected = len(randos) / 2
randos[randos < 0.5] = 0
randos[randos >= 0.5] = 1
female_count = sum(randos)
male_count = len(randos) - female_count
female_diff = (female_count - expected)**2 / expected
male_diff = (male_count - expected)**2 / expected
chi_squared = female_diff + male_diff
chi_squared_values.append(chi_squared)
plt.hist(chi_squared_values)
plt.show()
```

What I expected to happen:

A plot to be produced without an error.

What actually happened:

An error was produced along with a plot.

```
ValueError:
Invalid value of type 'numpy.float64' received for the 'bargap' property of layout
Received value: -2.220446049250313e-16
The 'bargap' property is a number and may be specified as:
- An int or float in the interval [0, 1]
```

If I comment out the last line (`plt.show()`

) then a plot is produced without error along with the three objects returned by `plt.hist()`

(values, bins, patches). Also, if I reduce the loop from `1000`

to `44`

iterations, there is no ‘bargap’ error and a plot is produced. At 45 iterations and above, the error is generated.

Anyone have an idea why this is happening? It seems to be related specifically to the DQ platform as I can’t find anything related on Stack Overflow.