标签:inpu pass -- 输入 pre user put 简单的 name
重建一个简单的登录界面,输入证号密码错误三次的话自动退出程序
_username = "qihaojie"
_password = "qihaojie"
print ("请输入您的证号和密码!")
for i in range(3):
username = input("请输入您的证号:")
password = input("请输入您的密码:")
if _username==username and _password==password:
print("恭喜{name}登陆成功".format(name=username))
break
elif _username!=username and _password!=password:
print("您输入的证号密码错误,请重新输入!!!")
---------------------------------------------------------------------------
写一个猜年龄大小的游戏
name = 24
count = 0
while count<3:
age = int(input("年龄:"))
if age == name:
print("猜对了")
break
elif age>name:
print("往小了猜")
else:
print("往大了猜")
if count ==3:
counts = input("还猜吗:")
if counts == ‘不猜了‘:
break
elif counts != ‘不猜了‘:
count = 0
---------------------------------------------------------------------
标签:inpu pass -- 输入 pre user put 简单的 name
原文地址:https://www.cnblogs.com/qihaojie/p/11568407.html