Python/maths/average.py
Adeoti Ayodeji 12a16d63b7 Update average.py (#908)
Reduced lines of code and extra processing on the line: n += 1
2019-06-22 12:42:28 +08:00

14 lines
207 B
Python

def average(nums):
sum = 0
for x in nums:
sum += x
avg = sum / len(nums)
print(avg)
return avg
def main():
average([2, 4, 6, 8, 20, 50, 70])
if __name__ == '__main__':
main()