This community-built FAQ covers the “Standard Deviations and Normal Distribution, Part II” exercise from the lesson “Statistical Distributions with NumPy”.
Paths and Courses
This exercise can be found in the following Codecademy content:
Q. The average score on the SATs is 1000 and the standard deviation is 100.
2000 students took the exam. How many would you expect to have scores within the range of one_above and one_below ?
Save your response to the variable one_std and print it to the terminal.
How to answer this question…
2000 students took the exam. How many would you expect to have scores within the range of one_above and one_below? i.e 1100-900…
I dont even know what is the mean or how many marks exam was it
which equals to 1360, since the rules for normal distributions says:
68% of our samples will fall between +/- 1 standard deviation of the mean.
and in this exercise they asked for How many would you expect to have scores within the range of one_above and ‘one_below’ (range).
hi i liked the way you did it, its surly more complicated but you used some previous lessons.
i copied your code and it works fine if you change the | “or” to & “and” in line
expected_std= one_std[(one_std > one_below) | (one_std< one_above)]
i dont know why yet but it worked with me like that
one more note, you can use the len function instead of the count
In Python 2, 68 / 100 is 0 since integer division always resulted in an integer. 0.68 is not an integer, and the closest integer once truncated is zero.
When the brackets were left off, the multiplication occurred first thus avoiding multiplication by zero.
In Python 3 this will no longer apply. All division results in a float.
One suspects there is an old version of Python running behind the scenes. Could be an old version of NumPy, for that matter. See if you can get things to run as expected in your environment or an up to date sand box.
So that would suggest an out of date environment in the courseware. There should be a channel for you to communicate this information to the CC team, if you care to explore that avenue. Apart from basic diagnostics, there’s not much else we can do from here. Hope you can work around the existing setup. At least now you know to expect some quirks.