003_if_else_多分支elif及缩进

num = 21
guessNum = int(input("input your num:"))
# 判断语句后面必须接":"且判断条件内的语句必须有缩进,但不一定必须是缩进一个Tab,只需判断条件内的每条语句的缩进是一样的即可
if guessNum == num:
    print("you got it~")
    print("you got it...")
    print("you get it!!!")
else:
    print("sorry, you lost it")
    print("ou, you are out")
    print("bye bye")

score = int(input("please input you score:"))
if score > 90:
    print(">90,A")
# elif是多分支if语句
elif score > 80:
    print(">80,B")
elif score > 60:
    print(">60,C")
else:
    print("不合格,get out")
003_if_else_多分支elif及缩进_第1张图片
运行结果

你可能感兴趣的:(003_if_else_多分支elif及缩进)