Created
June 6, 2009 21:30
-
-
Save built/125008 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# One of several ways to do a ternary operation in Python | |
# For more discussion, see: http://drj11.wordpress.com/2007/05/25/iversons-convention-or-what-is-the-value-of-x-y/ | |
# "AB"[True] => A, likewise "AB"[False] => B | |
# In this way you can index any two item list with a test: | |
card_type = ["Low", "High"]][card_value < 10] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment