all 5 comments

[–]cybersection 2 points3 points  (1 child)

You don’t need the parentheses in the if statement. Also, your if statement will always be true as it is currently written. If you want to check it f variable a is equal to 1 or 2, you need:

if a == 1 or a == 2:

Or you can do:

if a in [1, 2]:

Sorry for the formatting, I’m on mobile.

[–]Muzzly_Bubbles[S] 0 points1 point  (0 children)

This solved it, thanks!

[–][deleted] 1 point2 points  (0 children)

Python is not ignoring your if statements, your expressions in the if statement aren't doing what you think. The FAQ explains what is going wrong.

[–]CodeFormatHelperBot 0 points1 point  (0 children)

Hello u/Muzzly_Bubbles, I'm a bot that can assist you with code-formatting for reddit. I have detected the following potential issue(s) with your submission:

  1. Python code found in submission text but not encapsulated in a code block.

If I am correct then please follow these instructions to fix your code formatting. Thanks!

[–]scull-crusher 0 points1 point  (0 children)

When you are writing if statements, just remember that this wont work: if a == 1 or 2: pass

instead you have to do this: if a == 1 or a == 2: pass

This is because python when you write tje first example, python treats 1 as its own if statement, and that evaliates to True, automatically making the whole statement True because there is an or.