Shorter answer?


#1



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

def grades_sum(grades):
    total = 0
    for n in grades:
        total += n
    return total
print grades_sum(grades)

def grades_average(grades):
    av = grades_sum(grades)/float(len(grades))
    return av
print grades_average(grades)


#2

Hints:

  1. Think hard. Do you really need the av variable?
  2. There's a shorter, built-in method to get the sum of an array...