Quotes help make search much faster. Example: "Practice Makes Perfect"

Friday, November 30, 2012

Codecademy: Computing the average


#sample solution


grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def grades_sum(grades):
sum = 0
for grade in grades:
sum = sum + grade
return sum

print grades_sum(grades)

def grade_average(grades):
sum = grades_sum(grades)
average = sum/len(grades)
return average

print grade_average(grades)

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts