Commit 620e7cd9 by BellCodeEditor

save project

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