In my code I input some data points and it outputs an array of intervals between the data points: For example, [92 97 97 99 99 99 97 97 98 97 99 98 95]
If there is a value that is 20% less or greater than the mean of the intervals, I want it to print 'Intervals are irregular'. If there is not a value that is 20% less or greater than the mean of the intervals, I want it to print 'intervals are not irregular'.
I calculate the mean of the values in this way:
averageinterval = np.mean(intervals)
Then I tried to write a for loop:
for interval in intervals:
if interval is 20% > averageinterval:
print('intervals are irregular')
This gives a syntax error. How can I correctly write this loop?