i am trying to create a program for username login etc.
My question is this: How can i tell python that it is ok if the user does not answer Exactly as i program it?
i.e. 1) If in the following code the user answer JACK, it will return "Try gain" (but JACK is also correct)
2) If answers jack Daniel (which is also correct because he answered with name and surname)will also return "Try again"
My simplified code:
any suggestions for solving those 2 problems?? thank you in advance!
My question is this: How can i tell python that it is ok if the user does not answer Exactly as i program it?
i.e. 1) If in the following code the user answer JACK, it will return "Try gain" (but JACK is also correct)
2) If answers jack Daniel (which is also correct because he answered with name and surname)will also return "Try again"
My simplified code:
1 2 3 4 5 6 7 8 9 |
username = input ( "login: " ) user1 = ( "jack" ) user2 = ( "Jill" ) if username = = user1 : print ( "Welcome Jack!" ) elif username = = user2 : print ( "Welcome Jill!" ) else : print ( "Try again" ) |