python的严格缩进可以避免else悬挂

 

1、

# prize test

age = 20
score = "A"

if age < 18:
    if score == "A":
        print("congratulations!!!")
    else:
        print("score not A!!!")
else:
    print("age excess 18!!")

 

posted @ 2021-02-06 23:06  小鲨鱼2018  阅读(93)  评论(0编辑  收藏  举报