I am trying to grasp the basics of "IF" statements in the python.
But for what ever reason cant.
Now whats that's suppose to do is ask for user name much like it dose, and if it is equal to the user name of twenty three then precede to asking for the password. (in this case the pasword uses the same if statement), although if you get the user name wrong then if will not let you go any further and will exit the program, as seen in the lines were else: exit.
although when i run the application, if i get the username wrong it moves on to the password ands that even if i hit enter for both will allow me to enter the program....
I need it so that if you get the user name wrong you will be exitied out of the program and if you get the password wrong, same deal...or....
heres the or.
If you get the user name wrong to GOTO what ever line the program starts on...
but that GOTO can only be applied to the user name.
But for what ever reason cant.
Code:
username= raw_input('Username for this program : ') if username < 23: username = 23 print 'I am sorry you are not the user of this program.' elif username == 23: print "Welcome user #23" elif username != 23: exit else: exit
although when i run the application, if i get the username wrong it moves on to the password ands that even if i hit enter for both will allow me to enter the program....
I need it so that if you get the user name wrong you will be exitied out of the program and if you get the password wrong, same deal...or....
heres the or.
If you get the user name wrong to GOTO what ever line the program starts on...
but that GOTO can only be applied to the user name.
Comment