Let's assume we have 2 lists a = [1,2,4,3,5] and b = [103,122,800,500,1000]
is there an optimized way that I can check that they are "increasing together"?
My current solution, employs a loop:
for i in range(1,len(a)):
if (a[i-1] < a[i] and b[i-1] > b[i]) or (a[i-1] > a[i] and b[i-1] < b[i]):
print('wrong')
Is there a better way?
Notes:
- The solution does not need to be list specific (really any data structure would work)
- The two iterables do not need to increase by the same number of units, just have to increase together.