
January 2nd, 2013, 03:03 PM
|
 |
Contributing User
|
|
|
|
Contributing User b49P23TIvg is correct, you really should limit the number of attempts to something reasonable.
You can rewrite your code like this:
Code:
#Password
limit_attempts = 5
attempts = 1
while True:
password = raw_input("Enter your password: ")
if password == "letmein":
print "Hey your in!"
break
else:
print "Denied, try again!"
if attempts >= limit_attempts:
print"Sorry, you got to go now!"
break
attempts += 1
raw_input("Press enter to exit")
__________________
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
|