mercredi 23 septembre 2015

Python conditional one or the other but not both

I am trying to compile an if statement in python where it checks two variables to see if they are <= .05. Now if both variables are True, I just want the code to pass/continue, but if only one of the variables are True, then I want the code to do something. eg:

ht1 = 0.04
ht2 = 0.03

if (ht1 <= 0.05) or (ht2 <= 0.05):
    # do something
else:
    pass

I don't think this example will work the way I would want it as my understanding of OR is 1 condition returns True or both conditions return True. If someone could assit in pointing me in the right direction, it would greatly be apprecaited.

Aucun commentaire:

Enregistrer un commentaire