Sending a letter


#1

whats wrong here ?

I get that letter_... seems to be missing

 def get_letter_grade(score):
score = int
if score >= 90 :
  return "A"
elif  score >= 80:
  return "B"
elif score >= 70:
  return "C"
elif score >= 60:
  return "D"
else :
  return "F"
print get_letter_grade(get_average(lloyd))

#2

Hi @blublup ,

It is important to format code when you post it. That enables users to see your indentation and other important details.

See How do I format code in my posts?.

Check the parentheses here ...

print get_letter_grade(get_average(lloyd)

Are they closed?


#3

fixed the format ... so i still don't get the problem


#4

This statement should not be there ...

score = int

It does not convert score to an int; it merely assigns the int built in function to score. You could do this ...

score = int(score)

Make sure that all of the statements within the get_letter_grade function are indented.


#5

here:

def get_letter_grade(score):
score = int(score)
if score >= 90 :
  return "A"
elif  score >= 80:
  return "B"
elif score >= 70:
  return "C"
elif score >= 60:
  return "D"
else :
  return "F"
print get_letter_grade(get_average(lloyd))

still not working :frowning:


#6

What message do you get when you submit the code?


#7

thanks .... Def was with space !!!
thanks a lot
it worked !


#8

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