Advertisement
Guest User

question1

a guest
Feb 5th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. >> def mar():
  2.     pw = 'a' # password
  3.     upw = input('enter pw') #user inputed password
  4.     count = 3
  5.     currentcount = 0
  6.     while currentcount < count:
  7.         if pw == upw:
  8.             print('correct')
  9.             exit()
  10.         else:
  11.             print('try again')
  12.             currentcount = currentcount +1
  13.             if currentcount == 3:
  14.                 print('youve been denied')
  15.                 exit()
  16.  
  17. >>> mar()
  18. enter pwa #CORRECT password
  19. correct
  20. Traceback (most recent call last):
  21.   File "<pyshell#18>", line 1, in <module>
  22.     mar()
  23.   File "<pyshell#17>", line 9, in mar
  24.     exit()
  25.   File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site.py", line 362, in __call__
  26.     raise SystemExit(code)
  27. SystemExit: None
  28.  
  29. >>> mar()
  30. enter pww #WRONG password
  31. sorry
  32. sorry
  33. sorry
  34. youve been denied
  35. Traceback (most recent call last):
  36.   File "<pyshell#23>", line 1, in <module>
  37.     mar()
  38.   File "<pyshell#17>", line 15, in mar
  39.     exit()
  40.   File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site.py", line 362, in __call__
  41.     raise SystemExit(code)
  42. SystemExit: None
  43. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement