Ejemplo 1: pitón promedio
import numpy as np
values=[1,10,100]
print(np.mean(values))
values=[1,10,100,np.nan]
print(np.nanmean(values))
Ejemplo 2: promedio de Python
# Using statistics package to find average
import statistics as st
my_list = [9, 3, 1, 5, 88, 22, 99]
print(st.mean(my_list))
Ejemplo 3: promedio de Python
def avrg(values): # where values is a list of all values
return sum(values)/len(values)
Ejemplo 4: como calcular la media en python
import statistics
a = [1,2,3,4,5]
mean = statistics.mean(a)
#Similar for other values such as variance, standard deviation
Ejemplo 5: calcular la media en python
def calculate_mean(n):
s = sum(n)
N = len(n)
mean = s / N
return mean
Ejemplo 6: como encontrar el promedio en python
import numpy
avreage_1 = numpy.mean(avreage)# this finds the mean from the array "cost"
print("words are printed here if needed",avreage_1) # this prints the mean that was found above
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)