Simple question, hopefully simple answer?


#1

Hello all, I have a bit of really simple code here that just prints out each bit of data in the list for 2/9 in this section. Here it is:

grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def print_grades(grades_input):
for x in grades_input:
print x

print print_grades(grades)

yes the formatting gets messed up I know and it works fine, but at the end of the prints that it puts out, it has “none”. Why is this and is there a way to get rid of it? Thanks!


#2

by default, a function returns None at the end.

by putting a print statement in front of the function call, you cause the returned result to be printed


#3

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