编写登录接口:
输入用户名及用户命名
认证成功后,显示欢迎信息
认证失败3次后,退出程序
写一个循环,重要的思路清晰,必然需要逻辑图。
#!/usr/bin/env python
#-*-coding utf8-*-
#----practive---
account = "1257063655"
password = "123456"
for i in range(3):
account1 = input("account:")
password1 = input("password:")
print(account1,password1)
#for i in range(3):
if account1 == account and password1 == password:
print("welcome to you!")
break
else:
print("password is wrong!")
print("you tried too many!")
欢迎大家指点
原文地址:http://www.cnblogs.com/linu/p/7255587.html