Hey guys got my program running..sorta heres the deal im making a login script and if they dont get the login right then they have to solve a mathmatical problem and if they get it right then it tells them the login problem is that if they get the problem wrong then it loops them back to the login which is very inconvient how do i change this.
while True:
username = raw_input('Username: ')
password = raw_input('Password: ')
if username == 'Uname' and password == 'Pword':
print 'Welcome'
raw_input("press any key to exit")
break
else:
problem = 22
while problem == 22:
problem = int(raw_input('ERROR ACCESS DENIED, Solve to lift quarantine\n(7 * 3) - 3 + 4: '))
if problem == 22:
print ('Quarantine lifted, username is Uname and password is Pword')
break
else:
print ('invalid')
2 replies to this topic
#1
Posted 21 January 2011 - 06:32 PM
|
|
|
#2
Posted 22 January 2011 - 05:50 AM
You need to use code tags. (the # button) Without those we can't see your indentation.
#3
Posted 22 January 2011 - 07:57 AM
Your problem is that once the user enters mathematical solution, and if wrong, it will overwrite problem variable and will no longer be 22 thus loop will stop.
A conclusion is where you got tired of thinking.
#define class struct // All is public.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









