Search code examples
pythonconditional-statementsinequalities

Is it possible to write an inequality with two arguments to be evaluated on one side in Python?


Is there a cleaner way of writing the following:

(a > b) and (a > c)

The following doesn't work, but this might illustrate the kind of thing I'm looking for:

a > [b, c]


Solution

  • One option, use max:

    a > max(b, c)