# 上班
today=input('>>: ')
if today == 'Monday':
print('上班')
elif today == 'Tuesday':
print('上班')
elif today == 'Wednesday':
print('上班')
elif today == 'Thursday':
print('上班')
elif today == 'Friday':
print('上班')
elif today == 'Saturday' or today == 'Sunday':
print('出去浪')
else:
print('''必须输入其中一种:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
''')
#列:
age = 26
is_beatiful = True
start = "双鱼座"
if age > 17 and age < 30 and is_beatiful and start == "双鱼座":
print("are you ok")
else:
print(" are you no")
age = 26
is_beatiful = True
start = "双鱼座"
if age > 17 and age < 30 and is_beatiful and start == "双鱼座":
print("are you ok")
else:
print(" are you no")
二.if 单分支
# 伪代码展示
if 条件1:
代码1
代码2
代码3
示例
# 系统验证
print("start")
in_name = "mm"
in_passwd = "1234"
name = "mm"
passwd = "1234"
if in_name == name and in_passwd == passwd:
print("登录成功")
print("end")
三.if…else 双分支
# 伪代码展示
if 条件1:
代码1
代码2
代码3
else:
代码1
代码2
代码3
示例
# 结婚
song='man'
age=27
is_verygood=True
if song == 'man' and (age > 18 and age < 26 or is_verygood):
print('结婚')
else:
print('bujiehun')