Create a function that returns the average of an array of numbers ("scores"), rounded to the nearest whole number. You are not allowed to use any loops (including for, for/in, while, and do/while loops).

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def average(array):
	

Solutions:
def average(array):
	return round(sum(array) / len(array))


from statistics import mean

def average(array):
	return round(mean(array))


from statistics import mean

def average(array):
	return int(round(mean(array), 0))


from numpy import mean

def average(array):
	return round(mean(array))


def average(array):
	print(array)
	return int(round(sum(array) / len(array)))


from statistics import mean as m1
from numpy import mean as m2, average as m3

def average(array):
	return round(sum(array) / len(array))
	return round(m1(array))
	return round(m2(array))
	return round(m3(array))


import numpy

def average(array):
	return round(numpy.average(array))


def average(scores):
	return round(sum(scores) / len(scores))


def average(a):
	return round(sum(a) / len(a))