1. 程式人生 > >登陸密碼驗證,超過3次退出

登陸密碼驗證,超過3次退出

class 密碼驗證 put pan col 錯誤 用戶 密碼 cnblogs

import getpass
i = 3
while i > 0:
    x = input (請輸入用戶名:)
    y = getpass.getpass(請輸入密碼:)
    if x == 123 and y == 456:
        print(登陸成功)
        break
    else:
        print(請重新輸入)
    i -= 1
if i == 0:
    print(錯誤次數超過3次)

登陸密碼驗證,超過3次退出