Programmers 평균 구하기

Solution

def solution(arr):
    return sum(arr) / len(arr)
  • reduce 이용
from functools import reduce
def average(list):
    return reduce(lambda x, y : x + y, list) / len(list)