Using inequality operators, I have to define a procedure weekend which takes a string as its input and returns the boolean True if it\'s \'Saturday
I wrote this answer for Can not get “while” statement to progress, but it was marked as a duplicate right before I submitted it. And it is an exact logical duplicate (x != foo or y != bar), so I'm posting this here in hopes that my answer might help somebody.
The answer is reproduced verbatim.
Your problem is here:
while username != logindata.user1 or username != logindata.user2:
...
while password != logindata.passw1 or password != logindata.passw2:
The username loop in English is something like, "Keep looping if the provided username is either not equal to user1, or not equal to user2." Unless user1 and user2 are the same, no string will ever let that evaluate to False. If 'username' is equal to user1, it cannot be equal to user2 (again, assuming user1 != user2, which is the case here).
The quick fix is to change the or to and. That way, you're checking whether username is not either of the available options. A better way to write that would be:
while not (username == logindata.user1 or username == logindata.user2):
But I would say that the correct way to write it, given what you're trying to do, is this:
while username not in [logindata.user1, logindata.user2]:
In English, something like, "Keep looping while the username is not in this list of usernames."
P.S. I was going to use a set instead of a list, for pedantic correctness, but it really doesn't matter for this, so I figured a list would be easier for a beginner. Just mentioning it before someone else does :).