Hello.
This is odd but I'm sure there is a perfectly good explanation.
Why is "501" and "502" evaluated as true for each item in the list?
HIT
HIT
HIT
HIT
HIT
HIT
>
If I look for each string individually it works.
PT300-XXXX
PB300-XXXX
PB102-XXXX
AL300-XXXX
>
Thanks
This is odd but I'm sure there is a perfectly good explanation.
Why is "501" and "502" evaluated as true for each item in the list?
my_list = ["PT300-XXXX", "PB300-XXXX","PB501-XXXX", "PB102-XXXX","AL300-XXXX","BD502-XXXX"]
for node in my_list:
if '501' or '502' in node:
print ("HIT")
continue
print (node) OUTPUT:HIT
HIT
HIT
HIT
HIT
HIT
>
If I look for each string individually it works.
my_list = ["PT300-XXXX", "PB300-XXXX","PB501-XXXX", "PB102-XXXX","AL300-XXXX","BD502-XXXX"]
for node in my_list:
if '501' in node:
continue
if '502' in node:
continue
print (node) OUTPUT:PT300-XXXX
PB300-XXXX
PB102-XXXX
AL300-XXXX
>
Thanks
