Advertisement
Guest User

Untitled

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