# How Is Everybody doing

#1

I have got strucked in this task even though it prints class average output as 83.6666667, But it says that it should print 83.6666666666667.
The task asked to print the class average of the students so i called the function and stored the result in a variable as
below and printed variable.Then i am getting incorrect output as 83.6666667

``````def get_class_average(students):
results =[]
for student in students:
results.append(get_average(student))
return average(results)
classavg = get_class_average(students)
print "class avg is %f:" %classavg``````

when i don't use or store the result in an variable classavg and directly use the statement which is as below

``````def get_class_average(students):
results =[]
for student in students:
results.append(get_average(student))
return average(results)
print get_class_average(students)``````

it is displaying the correct out or correct average as 83.6666666666667

I could not understand why is this so?. The get_class_average function returns the results output and there is some variable to catch hold of it and print it. I don't understand when the function return some value and immediately we use print statement to print it. How this can be true?. Please can body explain this?

``````     return average(results)
print get_class_average(students)``````

#2

Hi @samauden ,

Here, you used a format specifier to handle the output of the value of `classavg` ...

``print "class avg is %f:" %classavg``

For the `%f` format specifier, the default is six decimal places. When Codecademy tests your code, it is looking for ten decimal places.

#3

Oh, Thanks. You mean we can use variables to store the values returned by the function from python point of view which is absolutely legitimate if we keep aside the floating precession of codeacademy

#4

Hi, @samauden ,

You can use variables to store values, and then use those variables in statements that follow. In general, whether or not Codecademy passes your submitted code depends on whether the code conforms to their instructions, but that may vary a little bit. In this exercise, they want to see the output in ten decimal places, and without the `"class avg is "` string preceding it, and without the colon following it. But, you could still use a variable and a format specifier to achieve that result, if you want.

The following will work for this exercise, because it specifies ten decimal places for the output, with no extra content ...

``print "%.10f" % classavg``

#5

Thanks a lot. Now it's clear