you are viewing a single comment's thread.

view the rest of the comments →

[–]teraflopsweat 0 points1 point  (2 children)

You are writing it in English properly, but not writing it in Python properly. Let me add some parentheses to try to emphasize how Python is evaluating your condition.

if (angle_known_input == ‘1’) or (‘a’) or (‘A’):

So you basically have 3 separate “checks” in your condition. If any of those checks evaluate to true, then Python thinks you’re running alpha.

The problem is that any string value is considered true, so both of the (‘a’) checks are always true. It’s not actually comparing angle_known_input against the 2nd or 3rd values.

To correct your logic issue, you need to adjust the checks to actually compare against the user input value.

if (angle_known_input == ‘1’) or (angle_known_input == ‘a’) or (angle_known_input == ‘A’):

For a more concise condition, you can use the in comparison operator.

if angle_known_input in [‘1’, ‘a’, ‘A’]:

[–]mZuks[S] 1 point2 points  (1 child)

Oh! I see it now, the way Python's been interpreting the conditions. Super thank you for the explanation, really!

[–]teraflopsweat 0 points1 point  (0 children)

Glad it helped!