#Why does my code loop?
17 messages · Page 1 of 1 (latest)
if 'yes' or 'Yes' in yda:
This will always be true as well
It's better to ask, why those two always evaluate to true
You know that a non-empty true has a true truth value right?
Okay so this is what's happening ```py
if 'no' or 'No' <==> if ("no") or ("No") <==> if (True or True) <==> if True
if 'yes' or 'Yes' in yda <==> if ("yes") or ("Yes" in yda) <==> if (True) or (?) <==> if (True or ?) <==> if True
Do you see how both condition s are always true
Similar thing with if exist_usr_nm and exist_usr_ps in data_collect:
That is evaluating exist_usr_nm and exist_usr_ps in data_collect seperately and then putting them together
Which I doubt is what you want
In English, if you want to do if X or Y in Z, you can't do it directly like that in python
Instead something like if X in Z or Y in Z is needed
Because you check if X is in Z and Y is in Z seperately
Then check if at least one of those conditions is true
Similar thing with and
if X in Z and Y in Z
It depends on what you mean by "end everything". Do you mind elaborating what you mean by "everything"?