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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -