0

the output I'm getting is: Your grade is X none I can't seem to figure out how to get rid of none.

def computegrade (scr):
    score = float (scr)
    if score >= 0.9 :
        print ("Your grade is A")
    elif score >= 0.8 :
        print ("Your grade is B")
    elif score >= 0.7 :
        print ("Your grade is C")
    elif score >= 0.6 :
        print ("Your grade is D")
    elif score < 0.6 :
        print ("Your grade is F")
    else :
        print ("Enter digits you moron")

scr = input("What was your score?\n")
print (computegrade (scr))

1 Answers1

2

You need a return statement to actually return a value from a function. Here you just print, so you do not actually return anything.

Just replace your print() with return, eg return "Your grade is F" and you'll be good.

Guillaume
  • 2,325
  • 2
  • 22
  • 40