[Tutor] Conditional Statement without if statement?

David bouncingcats at gmail.com
Tue Feb 8 05:03:26 EST 2022


On Tue, 8 Feb 2022 at 20:42, Barrett Ferguson <barrettf50cal at gmail.com> wrote:

> Do NOT use an if statement in your solution.

Hi,

There's a syntax named "conditional expression"
which is similar to an if statement, but it is not a
statement. It is an expression (an expression is
not a statement). And it can be used for variable
assignment. Maybe that's what you're looking for.
Discussed here:
  https://realpython.com/python-conditional-statements/#conditional-expressions-pythons-ternary-operator


More information about the Tutor mailing list