输入用户名密码;
登入成功后提示欢迎信息;
三次登入失败后锁定。
编写如下:
# Author: Ewan Wang
for i in range(3):
username = input("username:")
password = input("password:")
if username =="Wang"and password =="123":
print("Welcome to the new world!")
break
else:
print("Username or password is wrong,please re-enter...")
else:
print("The system has been locked.")
原文:http://www.cnblogs.com/akonj3/p/7593884.html