Python equivalent to a C trick

Dan danmoskowitz at gmail.com
Tue Aug 10 02:55:08 EDT 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