“Encontre a média da lista python” Respostas de código

Valor médio dos elementos da lista em 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

média de uma lista python

l = [15, 18, 2, 36, 12, 78, 5, 6, 9]

# By using the built-in statistics library
import statistics
statistics.mean(l)  # 20.11111111111111

# By defining a custom function
def average(my_list):
  return sum(my_list) / len(my_list)
average(l) # 20.11111111111111
Ahh the negotiatior

Encontre a média da lista python

3,3,4,5,10
Md. Hasibul Islam

Respostas semelhantes a “Encontre a média da lista python”

Perguntas semelhantes a “Encontre a média da lista python”

Procure respostas de código populares por idioma

Procurar outros idiomas de código