the PHP ternary operator equivalent on Python

Luis M. Gonzalez luismgz at gmail.com
Wed Nov 23 10:13:04 EST 2005


This could be done easier this way:

L = [('odd','even')[n%2] for i in range(8)]




More information about the Python-list mailing list