I'm a C# developer looking to learn more about Python and how to think in a more functional programming manner.
I have the following which takes a series of grades and returns the average:
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]
def grades_sum(scores):
total = 0
for score in scores:
total += score
return total
def grades_average(grades):
return grades_sum(grades) / float(len(grades))
print(grades_average(grades))
What are some better functional programming / pythonic ways of approaching this problem?