What I am trying to do here is to compare integers within pairs.
if I have a list of pairs
[(10, 5), (6, 3), (2, 20), (100, 80)]
I would want to compare x > y for each of the pairs and return False if any of the pairs do not meet the condition
def function(list_or_tuple):
num_integers = len(list_or_tuple)
pairs_1 = list(zip(list_or_tuple[::2], list_or_tuple[1::2]))
print(pairs_1)
#pairs_2 = list(zip(list_or_tuple[1::2], list_or_tuple[2::2]))
#print(pairs_2)
for x1, y1 in pairs_1:
return bool(x1 > y1)
and my program keeps on returning True for the above example
I believe the program is only testing the first pair, which is (10,5)
what should I do to make my program test all the pairs in the list?