0

Jugadores de baloncesto

Hola. Quisiera saber si alguien me puede ayudar con este problema. Tengo que averiguar cuantos jugadores están dentro de la desviación media. players = [180, 172, 178, 185, 190, 195, 192, 200, 210, 190] # import numpy as np # desv = np.std(players) # varz = np.mean(players) pvrz = 0 pmed = sum(players) / 10 vrz = 0 for p in players: if p >= pmed: vrz +=(p - pmed )**2 else: vrz +=(pmed - p)**2 vrzm = vrz / 10 desv = vrzm ** 0.5 for p in players: if p >= pmed - desv & p<= pmed + desv: pvrz +=1 else: pvrz +=0 print(pvrz)

26th Feb 2022, 2:20 PM
Pablo Capo
1 Antwort
+ 4
I did!: for u in players: z += (x - u) ** 2 my x is your pmed and my z is your vrz. no if / else is needed.
26th Feb 2022, 3:27 PM
Paul
Paul - avatar