4/9 Can't print the results of my function


#1


This code returns "Make sure to print the result of the grades_sum() function." A couple other people seemed to be having this problem, and putting the print grades_sum(scores) outside the function was what was suggested and seemed to work.

This didn't work for me though. What am I missing?

Also tried the print grades_sum inside the function, as well as print result.

def grades_sum(scores):
    result = 0
    for a in scores:
        result += a
    return result
print grades_sum(scores)
grades_sum(scores)


#2

grades is the list that has your scores, no? scores is just an input variable. Why not print with your grades list?

(Also you don't need the line below your print statement)


#3

Yep that did the trick, completely missed that.

Thank you!


#4

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