Skip to content

Instantly share code, notes, and snippets.

@pykong
Created November 1, 2017 18:11
Show Gist options
  • Save pykong/42c7c311516d0302bb8537a8d0588dd5 to your computer and use it in GitHub Desktop.
Save pykong/42c7c311516d0302bb8537a8d0588dd5 to your computer and use it in GitHub Desktop.
In Python, not only is 0 False and 1 True, but True is 1 and False is 0. This means you can do weird things like:
>>> a = 1
>>> (a==1) + (a>0) + (a==2)
2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment