I have one tuple and one list:
t = (1, 2, 9)
l = range(2, 8)
and I want to check if there's at least one element of the list is in the tuple. I tried to use:
if (2 or 3 or 4 or 5 or 6 or 7) in l:
return True
but it works only for the number 2.
Now I'm using:
if 2 in l or 3 in l or 4 in l or 5 in l or 6 in l or 7 in l:
return True
but I think that's not the best way to do it. Is there a way to shrink this piece of code to make it more elegant?