python学习:条件语句if、else

时间:2022-01-20 12:14:27

条件语句:

  1.if...else...;

  2.if...elif...esle

举例:

  1.if...else...

  “age_of_princal = 56

  guess_age = int(input(">>>>:"))
        if guess_age == age_of_princal:
        print("Yes,you got it")
        else:
  print("No,it's wrong.")”

  2.if...elif...esle...

  "score = int(input("score:"))

  if score > 90:
  print("A")
  elif score > 80:
  print("B")
  elif score > 70:
  print("C")
  elif score > 50:
  print("D")
  else:
  print("加油")"