“So finden Sie Avrage Python” Code-Antworten

Calcutalt durchschnittliche 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

So finden Sie 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

So finden Sie 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

Python Avg

my_list = [1,2,3,4]

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

So finden Sie 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

Ähnliche Antworten wie “So finden Sie Avrage Python”

Fragen ähnlich wie “So finden Sie Avrage Python”

Weitere verwandte Antworten zu “So finden Sie Avrage Python” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen