jeudi 22 février 2018

Confused with logic of my if-statement

right = 0 
left = 0
if(left > right or (left and right) == 0):
    print 'doing task 1'
else:
    print 'doing task2'

for some reason no matter what value I give right or left (for example, if i set right to be 10 and left to be 2)... it always does the "doing task 1" condition.....does anybody know why?

Aucun commentaire:

Enregistrer un commentaire