testConinuos.py 175 B

123456789
  1. a = [0,1,0,3,0,0]
  2. b = [0]*6#6个月
  3. import numpy as np;
  4. for i in range(len(a)):
  5. if a[i] >= 1:
  6. b[i] = b[i-1] + 1
  7. else:
  8. b[i] = 0
  9. print(np.max(b))