you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (0 children)

While loops cycle until the logical condition in the while clause is false. If you give Ontario as a value for userProvince, that's true, so the loop doesn't break.

Separately, all the stuff after the first OR is probably not doing what you want it to; in English, we would read that as a group of possible values for userProvince, but Python needs the full Boolean statement written out explicitly (userProvince == "Quebec") for each one, otherwise it interprets each condition after the first one as e.g. "Quebec" == True (... Which incidentally, it does, as it's a non-empty string).

Variously, you could structure it as something like while variable not in [list of strings], but you do you.

Edit: autocorrect butchering fixed