You can use the any()
function:
if any(t[0] == 1 for t in yourlist):
This efficiently tests and exits early if 1
is found in the first position of a tuple.
You can use the any()
function:
if any(t[0] == 1 for t in yourlist):
This efficiently tests and exits early if 1
is found in the first position of a tuple.