編寫登陸接口
輸入使用者名密碼
認證成功後顯示歡迎資訊
輸錯三次後鎖定
#!/usr/bin/env python
# _*_coding:utf-8 _*_
import getpass
confirm_username="newton"
confirm_passwd="F=ma"
'''
user_name=input('Please input your user name:')
user_pass=getpass.getpass('Please input your pass word:')
if user_name == confirm_username and user_pass == confirm_passwd:
print("Congratulations, You have passed the securrity conform, Welcome to this beautiful world!")
else:
print("Please check your user_name or pass word, thanks")
'''
'''
input_cout = 0
while True:
if input_cout < 3:
print('This is the %d time your input your user name and password'%(input_cout+1))
user_name=input('Please input your user name:')
user_pass=getpass.getpass('Please input your pass word:')
if user_name == confirm_username and user_pass == confirm_passwd:
print("Congratulations, you have passed the password validation,welcome to python world!")
break
else:
print('This is the %d time your input your user name and password'%(input_cout+1))
print('Please check your user_name or password')
input_cout += 1
else:
print("You have try 3 times, you waste all your opportunity")
break
'''
input_cout = 0
while input_cout < 3:
# if input_cout < 3:
print('This is the %d time your input your user name and password'%(input_cout+1))
user_name=input('Please input your user name:')
user_pass=getpass.getpass('Please input your pass word:')
if user_name == confirm_username and user_pass == confirm_passwd:
print("Congratulations, you have passed the password validation,welcome to python world!")
break
else:
print('This is the %d time your input your user name and password'%(input_cout+1))
print('Please check your user_name or password')
input_cout += 1
''' else:
print("You have try 3 times, you waste all your opportunity")
break'''
```python