# if 语句
age = 22
if age >= 18:
print("已经成年")
print("欢迎来到成年人的世界")
print("以上if后面带缩进的是一个代码块整体")
# if else语句
age = 22
if age >= 18:
print("已经成年")
else:
print("你还未成年")
# 逻辑运算符 and or not
# 判断年龄在1-120之间使用 and 且的意思
age = 120
if age >= 1 and age <= 120:
print("年龄合理")
else:
print("年龄不合理")
# 任意一门成绩合格就算合格使用or 或的意思
python_score = 70
php_score = 55
if python_score > 60 or php_score > 60:
print("成绩合格")
# 取反操作使用 not 就是非的意思
is_employee = False
if not is_employee:
print("非本公司员工,禁止入内")
# if elif else语句
holiday = "母亲"
if holiday == "情人节":
print("今天是情人节")
elif holiday == "母亲节":
print("今天是母亲节")
elif holiday == "父亲节":
print("今天是父亲节")
else:
print("今天什么都不是")