7/9 [spoilers] testing function?


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-python/lessons/student-becomes-the-teacher/exercises/sending-a-letter?action=lesson_resume

<In what way does your code behave incorrectly? Include ALL error messages.>

<What do you expect to happen instead?>

```python

print get_average(lloyd)

<do not remove the three backticks above>

This exercise calls for the following:
"Print the resulting letter grade with print. Call the get_letter_grade function and pass in get_average(lloyd)."

The answer is code above.  Are we not calling the function?

#2

it seems the solution does not including calling get_letter_grade, how could we do this?


#3

I would resolve by calling both independently:

print get_letter_grade(lloyd)
print get_average(lloyd)

I was not sure what was meant by the exercise prompt: “Call the get_letter_grade function and pass in get_average(lloyd)”.

What does “pass in” in particular refer to? I couldn’t find relationship to the correct solution.


#4

but that won’t work, given get_letter_grade is only capable of converting a number grade to a letter grade, here:

print get_letter_grade(lloyd)

lloyd is not a number grade.

we pass in arguments at function call, for example here:

print get_letter_grade(lloyd)

we pass in lloyd as argument to get_letter_grade

to get this to work, we need to pass get_average(lloyd) into get_letter_grade

you could insert an additional step, call get_average with argument lloyd to get lloyd his (her? no idea xD) number grade, and store this in a variable, then pass this variable to get_letter_grade


#5

Which we did by defining the prior function. Understood, thank you!


#6

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