5. Computing the average syntax error


#1



Hey guys, i keep getting a syntax error as seen below


I know there must be some silly syntax error, but I just can't find it. Would appreciate a hint, thanks.


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

def grades_sum(scores):
    total=0
    for i in scores:
        total=total+i
    return total
    
def grades_average(grades):
    avg=0
    avg=grades_sum(grades) / float(len(grades)
    return avg
    
print grades_sum(grades)    
print grades_average(grades)


#2

avg=grades_sum(grades) / float(len(grades)

Here, you forgot to close the bracket. Add another ) after float(len(grades).


#3

That was it, thank you!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.