7. Sending a Letter

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

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)

1 Like

But I made the indentation similar to the if statement

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

1 Like

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

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.

1 Like

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

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

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

1 Like

i have been trying to tell him that :wink:

1 Like

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