7. Sending a Letter


#1
def get_letter_grade(score):
  if score >= 90:
  	return "A"
	elif score >= 80:
    return "B"
  elif score >= 70:
    return "C"
  elif score >= 60:
    return "D"
  else:
    return "F"

And it gives me this error:

File “python”, line 36
elif score >= 80:
^
SyntaxError: invalid syntax


#2

Looking at your code:

Screenshot_2018-04-12_17-03-08

it gives a syntax error, but it is an indent mistake (due to indent mistake, you get a syntax error)


#3

But I made the indentation similar to the if statement


#4

did you see my screenshot? Clearly the indent is not similar/the same as if


#5

No, no, the code got an extra indentation somehow, this is what it looks like:
image


#6

i have been on this forum for a long time, i have had this discussion before several times. I was always right, your indent is wrong, even though it doesn’t look like it.


#7

Okay. Tell me where to fix, then. Do I have to indent it all again? Delete the whole def and write it again?


#8

Your indent is wrong. Backspace till you get on the previous line, then press enter and it should indent the right way


#9

You can see in my screenshot which lines have wrong indent, you can re-indent those lines if you want to save yourself some work


#10

i have been trying to tell him that :wink:


#11

Thank you very much! It worked. You’re a lifesaver.