9/9 Review


9/9 Review

I am getting a "none" between my print of the grades and my print of the sum of the grades.
Your Total Grade is: 1045.5

I would expect that the none would not be there.
How do I get rid of the "none"

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

def print_grades(grades):
    for grade in grades:
        print grade

def grades_sum(grades):
    total = 0
    for grade in grades: 
        total += grade
    return total
def grades_average(grades):
    sum_of_grades = grades_sum(grades)
    average = sum_of_grades / float(len(grades))
    return average

def grades_variance(grades):
    average = grades_average(grades)
    variance = 0
    for grade in grades:
        variance +=(average - grade)**2/len(grades)
    return variance

print grades_variance(grades)

def grades_std_deviation(variance):
    return float(variance) ** 0.5

variance = grades_variance(grades)
print grades_std_deviation(variance) 

print 'Your Grades are: \n', print_grades(grades)
print 'Your Total Grade is: ', grades_sum(grades)
print 'Your Average Grade is: ', grades_average(grades)
print 'Your Variance from Average is: ', grades_variance(grades)
print 'Your Standard Deviation is: ', grades_std_deviation(variance)


In Python, if a function has no explicit return value, it will return a 'None' value (basically a value to signify "nothing") and print it to the console.