Skip to content

Instantly share code, notes, and snippets.

@tabouassaleh
Created August 22, 2012 16:05
Show Gist options
  • Select an option

  • Save tabouassaleh/3427055 to your computer and use it in GitHub Desktop.

Select an option

Save tabouassaleh/3427055 to your computer and use it in GitHub Desktop.
Conditional Expression in Python
my_value = condition and true_value or false_value
my_value = true_value if condition else false_value
if condition:
my_value = true_value
else:
my_value = false_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment