0

long story short, i'm new to using python and i am trying to raise a ValueError exception by check if an element of an array is not equal to one of two values. This is my logic and it

if valArray[0] != 'Val1' or 'Val2':
   raise ValueError(f' invalid value {valArray[0]})

what i think is going on is that it checking the value and immediately raising the exception.

Thanks in advance for any advice

james
  • 35
  • 3

0 Answers0