Created
July 28, 2022 01:51
-
-
Save MaddoxRauch/82c8e12357fb43c3636cb33d588d9677 to your computer and use it in GitHub Desktop.
A better way to chain comparisons
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
#instead of this | |
if a == 1 and b == 2 and c == 3: | |
print("All conditions met.") | |
# try this | |
if (a, b, c) == (1, 2, 3): | |
print("All conditions met.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment