Skip to content

Instantly share code, notes, and snippets.

@mogigoma
Created August 3, 2012 16:37
Show Gist options
  • Save mogigoma/3249338 to your computer and use it in GitHub Desktop.
Save mogigoma/3249338 to your computer and use it in GitHub Desktop.
For Fernando
strings = [
"zero",
"one",
"two",
"three",
"four"
]
n = 12
chosen = [strings[x] for x in range(len(strings)) if n & (1 << x)]
print chosen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment