Skip to content

Instantly share code, notes, and snippets.

@MaddoxRauch
Created July 28, 2022 01:51
Show Gist options
  • Save MaddoxRauch/82c8e12357fb43c3636cb33d588d9677 to your computer and use it in GitHub Desktop.
Save MaddoxRauch/82c8e12357fb43c3636cb33d588d9677 to your computer and use it in GitHub Desktop.
A better way to chain comparisons
#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