+ 1
Basketball players problem
players = [180, 172, 178, 185, 190, 195, 192, 200, 210, 190] mean = sum(players)/len(players) stdvar = (sum((v-mean)**2 for v in players)/len(players))**0.5 low, high = mean-stdvar,mean+stdvar count = len([v for v in players if low < v < high]) print(count)
1 Réponse
+ 1
try this one !
players = [180, 172, 178, 185, 190, 195, 192, 200, 210, 190]
import numpy as np
mean = np.mean(players)
sd = np.sqrt(np.var(players))
x=0
for y in players:
if y>=(mean-sd) and y<=(mean+sd):
x=x+1
print(x)