Why does my print_grades( ) not work?



Why does my print_grades( ) not work?


Some common issues with this exercise include:

  1. Using return inside of your print_grades() function, rather than printing the values
  2. Not using the print_grades() function at the end of your program (outside of the function with no indentation) and passing it the grades list
  3. Looping incorrectly by printing the entire list each time, rather than just the loop variable for the single grade

FAQ: Learn Python - Exam Statistics - Print those grades
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
print print_grades(grades)

After running the code, an additional output after ‘50.5’ is seen in the console as a ‘None’ value. Where is this coming from? The list looks fine and I think my code is good for the exercise.


None is the implicit returned value by the function.