Identical Answers with my version flagged as in correct - why

Screen Link:

My Code:

import matplotlib.pyplot as plt
import numpy as np

pop_mean = houses['SalePrice'].mean()
means = []
errors = []
x = 5
for i in range(100):
    a_mean = (houses['SalePrice'].sample(n=x, random_state=i).mean())
    an_error = pop_mean - a_mean
    means.append(a_mean)
    errors.append(an_error)
    x = x + 29


sample_size = np.arange(5,2905,29)

plt.scatter(sample_size, errors)
plt.axhline(0)
plt.axvline(2930)
plt.xlabel('Sample size')
plt.ylabel('Sampling error')

What I expected to happen:
the answer is correct :slight_smile:

What actually happened - I can’t see difference in the plot…

You are iterating 100 times we supposed to do it 101

image

3 Likes

The answer has been posted but i did find a difference visually too

1 Like

Thank you guys! Makes sense.

1 Like