一 、if、elif 判断语句
1、if else
Score = 70
if Score > 60:
print("NO")
else
print("YES")
在python中if和else的匹配主要是靠缩进来进行的, if 语句判断如果是Ture ,就可以执行该if下面的所有缩进的语句,返回False 则执行else 中的内容。
2、if elif elif else
Score = 70
if Score > 90:
print("A")
elif Score > 70:
print("B")
else :
print("C")
![](https://i-blog.csdnimg.cn/blog_migrate/9b6cdde88651c681c0f5cdaab6c0aacc.png)
if <条件1>:
<执行1>
elif <条件2>:
<执行2>
else :
<执行3>
程序会从第一个条件开始判断,如果进入判断 则后面的条件判断都不再执行,如果前面的条件都不满足,那么会执行else。