The result of an iteration produces:
93
93
93
93
...
96
96
96
108
and so on
I want to compare the first number to the next, e.g., (93, 93) - result True, True, True etc then (93,96) result False and so on.
To do this I made the following, with result:
93 93
93 93
93 93
93 93
93 96
It works but looks clunky. Is there a better way?
lst = []
def a_function(item):
l = len(item) # in this case the item is an np array, and need its length
tups = list(zip([l], [l][:1] + [l][1:]))
lst.append(tups)
a = lst[0][0][1]
b = lst[-1][0][0]
if a == b:
return True
else:
return False
The examples Ive seen start with a list a =[1,1,1,1,2,2.....], where I need to create this. Tks