I'm setting up a new script where I need to check if a list has all the elements between 2 numbers, to check the continuity of this list.
At the moment, I've tried to add the minimum value and the maximum value, and I compare it with the number of the elements on the list.
if max+min > 2*count:
continuity = 'no'
else:
continuity = 'yes'
Update
This is not a duplicate question. I'll explain with further information my question. I want to check If a study is realized on every X-value and Y-value.
For example, with 4 points, I have:
X=[1, 1, 2, 2]
Y=[1, 1, 2, 2]
Referring to X1=(1,1)
, X2=(1,2)
, ... and so on.
At the moment, I've tried with 2 dict:
countY = dict([(k, Y.count(k)) for k in set(Y)])
countX = dict([(k, X.count(k)) for k in set(X)])
I compare it with the max and min value, but I just search a function (if it exists) which allows me to do this, using less lines.