Answers for "python if variable is one of multiple values"

1

How to test multiple variables against a value?

x = 0
y = 1
z = 3

if 0 or 1 or 2 or 3 == x:
  print("This will not work")
if x == 0 or x == 1 or x == 2 or x == 3:
  print("This will work")
Posted by: Guest on December-15-2020

Code answers related to "python if variable is one of multiple values"

Python Answers by Framework

Browse Popular Code Answers by Language