Python statement always being executed assitance -
i have following condition statement:
if (sc == 'both') , (fc == 'true') or (bc == 'true'): if (sc == 'front') , (fc == 'true'): if (sc == 'back') , (bc == 'true'):
the problem second , third clause work expected,however, if sc equals both , both fc , bc false statement still executes, , don't know why.
you wrote
if ((sc == 'both') , (fc == 'true')) or (bc == 'true'): if (sc == 'front') , (fc == 'true'): if (sc == 'back') , (bc == 'true'):
i think meant
# or binds weaker , needs brackets if (sc == 'both') , ((fc == 'true') or (bc == 'true')): if (sc == 'front') , (fc == 'true'): if (sc == 'back') , (bc == 'true'):
you can and
, or
weaker operation on numbers correct:
if sc == 'both' , (fc == 'true' or bc == 'true'): if sc == 'front' , fc == 'true': if sc == 'back' , bc == 'true':
Comments
Post a Comment