Screen Link: https://app.dataquest.io/m/99/chi-squared-tests/4/generating-a-distribution

Code:

chi_squared_values =

import numpy as np

import matplotlib.pyplot as plt

chi_squared_values =

for i in range(1000):

random_values = np.random.random_sample(32561, )

random_values[random_values < .5] = 0

random_values[random_values >= .5] = 1

```
females = (random_values == 1).sum()
males = (random_values == 0).sum()
female_diff = (females-16280.5)**2/16280.5
male_diff = (males-16280.5)**2/16280.5
chi_squared = female_diff + male_diff
chi_squared_values.append(chi_squared)
```

plt.hist(chi_squared_values)

What I expected to happen:

print a plot

What actually happened:

Got an error

No plots were detected, but 1 plot was expected

**It started to work now!**