Review Please help!


#1

HI I have been stuck for a while please help!:grinning:

this is my work

print print_grade(grades)
print grades_sum(grades)
print grades_average(grades)
print grades_variance(scores)
print grades_std_deviation(variance)

this is what it says is wrong

Traceback (most recent call last):
File “python”, line 19, in
NameError: name ‘print_grade’ is not defined


#2

please post your full code


#3

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

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

def grades_sum(scores):
total = 0
for score in scores:
total += score
return total

def grades_average(grades_input):
sum_of_grades = grades_sum(grades_input)
average = sum_of_grades / float(len(grades_input))
return average

print print_grade(grades)
print grades_sum(grades)
print grades_average(grades)
print grades_variance(scores)
print grades_std_deviation(variance)


#4

the function is named print_grades, not print_grade which you use at function call


#5

thank you the next error said this
Traceback (most recent call last):
File “python”, line 22, in
NameError: name ‘grades_variance’ is not defined


#6

well, clearly there is no grades_variance function. I can’t access the exercise yet given my progress has been reset.


#7

here:

print grades_variance(scores)

where did you define scores? So far i can see, nowhere. Are you sure score is the right argument? I am nearly at the exercise


#8

grades_variance excepts grades list as argument, not scores as explained in this exercise


#9

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

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

def grades_sum(scores):
total = 0
for score in scores:
total += score
return total

def grades_average(grades_input):
sum_of_grades = grades_sum(grades_input)
average = sum_of_grades / float(len(grades_input))
return average

def grades_variance(scores):
avg = grades_average(scores)
variance = 0
for score in scores:
variance += (score - avg) ** 2
return variance / len(scores)

variance = grades_variance(grades)

print variance

def grades_std_deviation(variance):
return variance ** 0.5

print grades_std_deviation(variance)

print print_grades(grades)
print grades_sum(grades)
print grades_average(grades)
print grades_variance(scores)
print grades_std_deviation(variance)

the error

Traceback (most recent call last):
File “python”, line 39, in
NameError: name ‘score’ is not defined


#10

of this line:

i covered the problem already in my previous reply? You supply the wrong argument at function call


#11

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