python--- if 语句

#if-elif-else
# int(input('请输入你的分数:'))
grade = int(input('请输入你的分数:'))
if grade -ge 90:
    print('优秀')
elif grade -ge 70:
    print('良好')
elif grade -ge 60:
    print('及格')
else:
    print('不及格')
 
'''
    多行注释''' '''
'''
#if 常用来判断用户登录时输入的用户名和密码是否正确
#变量的命名定义规则:小写字母与下划线_小写字母

account = 'huan'
password = '123456'

print('please input account')
user_account = input()

print('please input password')
user_password = input()

if account == user_account and password == user_password:
    print('success')
else:
    print('failed')

#注意:user_password = input()
#用户名和密码是且的关系
#account == user_account and password == user_password :
#if 还可以嵌套if ,但是一般不建议嵌套,建议把if 下的嵌套语句封装成一个函数
#代码块,缩进

if condition:
    pass
elif expression:
    pass
else:
    pass

a = 1
b = 0 
a or b


当你的才化撑不起野心时,还是安静下来学习吧!
原文地址:https://www.cnblogs.com/carl007/p/12013104.html