Python IF multiple "and" "or" in one statement
Use parenthesis to group the conditions:
if value[6] in target and (value[0] in target or value[1] in target):
Note that you can make the in
lookups in constant time if you would define the target
as a set:
target = {1,2,3,4,5,6,f}
And, as mentioned by @Pramod in comments, in this case value[6]
would result in an IndexError
since there are only 6 elements defined in value
and indexing is 0-based.