Help! (Python Data Science 1st module project) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help! (Python Data Science 1st module project)

Hi guys, I am struggling with this exercise because I don't understand what goes wrong. Could you help me? I'll paste it down below because the upload of my code doesn't work (there must be a bug, ugh). # The given code includes a list of heights for various basketball players. # You need to calculate and output how many players are in the range of one standard deviation from the mean. players = [180, 172, 178, 185, 190, 195, 192, 200, 210, 190] mean = sum(players) / len(players) variance = sum([(elem - mean)**2 for elem in players]) / len(players) std = variance**(1/2) print (mean-std)

6th Jun 2021, 4:09 PM
Carola
Carola - avatar
2 Answers
+ 5
You calculated mean and sd, now you only need to take the player list and count how many of the players have (mean - sd) < height < (mean + sd)
6th Jun 2021, 4:57 PM
Lisa
Lisa - avatar
+ 1
Thank you very much! ♥️
6th Jun 2021, 5:38 PM
Carola
Carola - avatar