Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- count = 0
- for i in range(3):#循环三次终止输入
- user = input ('Please input your name: ')
- pwd = input('Please input your password: ')
- if user == 'liuchao' and pwd == '123456':
- print ('Welcome to Beijing')
- break #输入正确的用户名和密码显示欢迎信息并结束
- else :
- if count < 2 : #第三次输入错误后打印锁定提示不再显示再出输入
- print ('please again') #提示再次输入
- count +=1
- else :
- print ('You are not allowed to enter !!!') #锁定提示
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement