Skip to content

Instantly share code, notes, and snippets.

@pmbrull
Created April 2, 2022 13:49
Show Gist options
  • Save pmbrull/b4982cc2cdde107f8015ad55eb1ed656 to your computer and use it in GitHub Desktop.
Save pmbrull/b4982cc2cdde107f8015ad55eb1ed656 to your computer and use it in GitHub Desktop.
Python truth 5
# The first argument is True
coffee = 10
milk = None
coffee or milk # 10, milk is not evaluated
coffee and milk # None, both expressions are evaluated
# The first argument is False
coffee = None
milk = 5
coffee or milk # 5, both expressions are evaluated
coffee and milk # None, milk is not evaluated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment