How can I test my get_letter_grade function?


How can I test my get_letter_grade function?


First, be sure you print your function test outside of any other functions, otherwise it won’t print when you Run your code because it’ll be inside of a function!
So once you’ve got your print statement outside of any functions, totally unindented, you write out your function name, get_letter_grade(). Now we’re ready to pass it a value.
Unlike we’ve usually done up to this point, we’re going to pass our function another function call as an argument! We can do this because get_average() returns a number, so it’s equivalent to passing a value in normally.
We should end up with something like print function_name(other_function(student_name)).


In addition to this explanation I recommend to read the following post:

The post mentioned above, explains the importance of return but in the last section the scope of print is also well addressed.

1 Like