On Jul 27, 10:13 pm, ssecorp <[EMAIL PROTECTED]> wrote:
> I have seen somewhere that you can write something like:
>
> x*x if x>10
>
> but exactly that doesn't work and I can't get any variation to work.

It's called a ternary operator. The format is:

<label> = <true-value> if <condition> else <false-value>

> it is possible to nest with an else too.

Sure. You can extend the <false-value> with another ternary operator:

<label> = <value1> if <condition1> else <value2> if <condition2> else
<value3>
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to