본문 바로가기

Programming/Python

[Python] 파이썬에서 평균 구하는 방법

1. 리스트로 구하기

lst = [1,2,3,4,5,6,7,8,9,10]
print(sum(lst) / len(lst))

 

2. numpy 패키지로 구하기

import numpy as np

np_array = np.array(lst)
print(np_array.mean())