Commit 620e7cd9 by BellCodeEditor

save project

parent 3026e69a
Showing with 16 additions and 22 deletions
i = 3 try:
username = "python" age = int(input('你今年几岁了?'))
userpassword = "123456" except:
while True: print('要输入整数呀')
if i>0: else:
name = input("请输入用户名:") if age < 18:
password = input("请输入密码:") print('不可以喝酒噢')
i-=1 print('程序结束~~')
if name == username and password == userpassword: \ No newline at end of file
print("登陆成功!")
break
elif name != username:
print("用户名输入错误!请重新输入!")
print("温馨提示:您还有"+str(i)+"次登陆机会")
else:
print("密码输入错误!请重新输入!")
print("温馨提示:您还有"+str(i)+"次登陆机会")
else:
print("你的账户已被锁定,请一小时后再来")
exit()
print("欢迎来到贝尔编程!")
\ No newline at end of file
...@@ -5,6 +5,12 @@ def new_input(): ...@@ -5,6 +5,12 @@ def new_input():
if unit == 'q': if unit == 'q':
break break
else: else:
try:
unit = int(unit)
except:
print('请重新输入一个数字')
else:
total.append(unit) total.append(unit)
print('-'*30)
print(total) print(total)
new_input() new_input()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment