Advertisement
furas

Python - wrong password #3

Mar 21st, 2017
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. for number in range(1, 4):
  2.    
  3.     user_password = raw_input("enter your password: ")
  4.  
  5.     # if correct password then leave loop
  6.     if user_password == "j":
  7.         break
  8.    
  9.     print "wrong password nmr", number, ":", user_password
  10.  
  11. else:
  12.     # this part is executed only if `break` was not used in `for` loop
  13.     print "Sorry, you enter 3 wrong passwords. Goodbye"
  14.     exit()
  15.  
  16. print "You are logged in"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement