age = 180
age = 110
“”"
and
条件1 and 条件2
两个条件同时满足,就返回True
两个条件有一个不满足,就返回False
“”"
if age >= 0 and age <= 120:
print(‘正确’)
else:
print(‘错误’)
“”"
or:
条件1 or 条件2
两个条件只要有一个满足,就返回True
两个条件都不满足,返回False
“”"
python_score = 20
c_score = 30
c_score = 70
if python_score > 60 or c_score > 60:
print(‘考试通过’)
else:
print(‘准备补考’)
#要判断用户的输入是否为空
value = input(‘Value:’)
if value == ‘’:
print(‘请输入合法的值’)
if not value:
print(‘请输入合法的值’)