can anyone please tell me an error in the code written?

new code.txt (714 Bytes)



average = grades_average(grades)

why do you use grades? This mean, your function only works for a single list. The great thing about functions is that we can use them multiply times, for example to calculate the variance. Use the function parameter instead. Look in the instructions if you have to, its literally in there for you to copy paste

this two lines:

score = 0
score = score + 1

why do you have them? They don't do anything, remove them

this line:

variance = variance / len(scores)

Doesn't have the right indent level. You only want to calculate the variance of the list after the loop has finished running, so this line should be outside the loop


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