“Moyenne python” Réponses codées

Valeur moyenne des éléments de la liste dans Python

# Example to find average of list
number_list = [45, 34, 10, 36, 12, 6, 80]
avg = sum(number_list)/len(number_list)
print("The average is ", round(avg,2))
Comfortable Cow

Comment utiliser une fonction pour trouver la moyenne dans Python

 avreage_cost = cost
    avg = sum(avreage)/len(avreage) 
    print("The average amout you spent is ", round(avg,2))
Open Ostrich

Python moyen

import numpy as np
values=[1,10,100]
print(np.mean(values))
values=[1,10,100,np.nan]
print(np.nanmean(values))
Tremendous Enceladus

python avg

my_list = [1,2,3,4]

import numpy as np
print("mean = ", np.mean(my_list))
Filthy Falcon

Moyenne python

History = 97
English = 92
Math = 85
Science = 86
Total = History + English + Math + Science
Average = Total/4

print('Total of grades:', Average)
Assistant Lola

Python moyen

def cal_average(num):
    sum_num = 0
    for t in num:
        sum_num = sum_num + t           

    avg = sum_num / len(num)
    return avg

print("The average is", cal_average([18,25,3,41,5]))
Nervous Narwhal

Réponses similaires à “Moyenne python”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code