(test) ? a:b

Tobiah toby at tobiah.org
Fri Oct 24 13:23:26 EDT 2014


On 10/22/2014 01:29 AM, ast wrote:
> Hello
>
> Is there in Python something like:
>
> j = (j >= 10) ? 3 : j+1;
>
> as in C language ?
>
> thx


Out of all of the replies, I don't think anyone
actually offered the answer:


     a if condition else b






More information about the Python-list mailing list