1 count = 0 2 while count < 3: 3 user = input("User: ") 4 pwd = input("Password:") 5 if user == ‘lyu‘ and pwd == ‘123456‘: 6 print(‘Welcome back!‘) 7 break 8 else: 9 print(‘user or password is wrong‘) 10 count = count + 1
原文:https://www.cnblogs.com/Ohiocleveland/p/9782404.html