Python equivalent to a C trick

Dan danmoskowitz at gmail.com
Tue Aug 10 08:55:08 CEST 2004


Is there a python equivalent of this trick in C?

Logic_Test ? True_Result : False_Result

Example:
printf( "you have %i %s", num_eggs, num_eggs > 1 ? "eggs" : "egg" );



More information about the Python-list mailing list