I'm learning python3.5 recently, and I wrote a simple login interface code, which is barely more advanced than hello world. If the username and password are wrong three times, the login will be prohibited.
1 #/usr/bin/env python 2 # -*- coding:utf-8 -*- 3 4 username = "test" 5 password = "123456" 6 count = 0 7 while count<3: 8 name = input("用户名:") 9 passwd = input("密码:") 10 if username == name and password == passwd: 11 print("welcome user {name} login...".format(name=username)) 12 break 13 else: 14 print("Invalid username or password!") 15 count +=1 16 if count == 3: 17 print("you are Prohibit landing") 18 break