simple if statement

What is wrong with this code? Blender gives me no error, but always activates the one actuator… no matter what… ( set on a delay sensor for every 60 ticks) debug properties show that everything is working…

import bge
import random
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
one = cont.actuators[“one”]
zero = cont.actuators[“zero”]

R = random.randint(1,6)
own['Random'] = R

if R == 1 or 2:
    cont.activate(one)
elif R == 5 or 6:
    cont.activate(zero)
else:
    pass

main()

I got it to work with:

if R <= 2:
cont.activate(one)
elif R >= 5:
cont.activate(zero)
else:
pass

But, I would like to know what I did wrong with the or operator…

Your condition “R == 1 or 2” is interpreted as either “R == 1” is true OR “2” is true, by the order of operations in Python. And “2” is always true.

I think you wanted to write “R==1 or R==2”. Alternatively, “R in [1, 2]”.

Thank you, I had figured out a different way of writing it, but that was exactly what I needed to know…