“bagaimana menemukan avrage python” Kode Jawaban

Calcutalte rata -rata Python

# app.py

def averageOfList(num):
    sumOfNumbers = 0
    for t in num:
        sumOfNumbers = sumOfNumbers + t

    avg = sumOfNumbers / len(num)
    return avg


print("The average of List is", averageOfList([19, 21, 46, 11, 18]))
Envious Earthworm

bagaimana menemukan avrage python

# Example to find avearge of list
from numpy import mean
number_list = [45, 34, 10, 36, 12, 6, 80]
avg = mean(number_list)
print("The average is ", round(avg,2))
The CODER man

bagaimana menemukan avrage 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))
The CODER man

AVG PYTHON

my_list = [1,2,3,4]

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

bagaimana menemukan avrage python

Input : [4, 5, 1, 2, 9, 7, 10, 8]
Output : Average of the list = 5.75
Explanation:
Sum of the elements is 4+5+1+2+9+7+10+8 = 46
and total number of elements is 8.
So average is 46 / 8 = 5.75

Input : [15, 9, 55, 41, 35, 20, 62, 49]
Output : Average of the list = 35.75
Explanation:
Sum of the elements is 15+9+55+41+35+20+62+49 = 286
and total number of elements is 8.
So average is 46 / 8 = 35.75
The CODER man

Jawaban yang mirip dengan “bagaimana menemukan avrage python”

Pertanyaan yang mirip dengan “bagaimana menemukan avrage python”

Lebih banyak jawaban terkait untuk “bagaimana menemukan avrage python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya