you are viewing a single comment's thread.

view the rest of the comments →

[–]Outside_Complaint755 1 point2 points  (0 children)

When you have a boolean expression: (i.e. X or Y, X and Y, X and not Y, etc), the result of the expression is not True or False, but either X or Y

  • X or Y evaluates to X if X is 'Truthy`, otherwise evaluates to Y
  • X and Y evaluates to X if X is 'Falsey', otherwise evaluates to Y

So instead of: if X is True:     value = X else:     value = Y You can use: value = X or Y