# I.实现用户输入用户名和密码,当用户名为 seven 且 密码为 123 时,显示登陆成功,否则登陆失败!
username = input('please input your username:')
password = input('please input your password:')
if username == 'seven' and password == '123':
print('登录成功!')
else:
print('登录失败!')
# II.实现用户输入用户名和密码,当用户名为 seven 且 密码为 123 时,显示登陆成功,否则登陆失败,失败时允许重复输入三次
count = 0
while count < 3:
username = input('please input your username:')
password = input('please input your password:')
if username == 'seven' and password == '123':
print('登录成功!')
break
else:
print('登录失败!')
count += 1
# III.实现用户输入用户名和密码,当用户名为 seven 或 alex 且 密码为 123 时,显示登陆成功,否则登陆失败,失败时允许重复输入
while True:
username = input('please input your username:')
password = input('please input your password:')
if username in ['seven','alex'] and password == '123':
print('登录成功!')
else:
print('登录失败!')
# IIII.实现用户输入用户名和密码,当用户名为 seven 或 alex 且 密码为 123 时,显示登陆成功,否则登陆失败,失败时允许重复输入三次
count = 0
while count < 3:
username = input('please input your username:')
password = input('please input your password:')
if username in ['seven','alex'] and password == '123':
print('login successful')
break
else:
print('login failure')
count += 1