Brief introduction of if elif else and indent in Python

  • 2020-10-31 21:51:13
  • OfStack

The code is as follows:


scole = input("input your scole:")
if scole>90:
  print("A")
elif scole>80:
  print("B")
elif scole>70:
  print("C")
elif scole>60:
  print("D")
elif scole>50:
  print("E")
else :
  print("OUT")

Only the item that first meets the criteria is executed.

All the indents have to be 1,

You can use the TAB key, but it is not recommended, as it will be different in unused systems and is not portable.

It is recommended to use 4 space keys. You can set the TAB key input to automatically convert to 4 space keys.

conclusion


Related articles: