1. if 语句模板:
if 条件:
运行代码1,
运行代码2,
运行代码3
elif:
运行代码
else:
输出语句
举例:输入账号密码,判断登录成功或者登录失败
username = input('请输入您的账户:')
passward = input('请输入您的密码:')
usn = 'zt'
pwd = '123'
if username == usn and passward == pwd:
print('登录成功')
elif username !=usn or passwarf != pwd:
print('您输入的账号或者密码有一项错误')
else:
print('登录失败!!!')