fork download
  1. def sectors(arr):
  2. l, last = 0, len(arr) - 1
  3. while l < last:
  4. l = arr[l+1:].index(arr[0]) + l + 1
  5. if last % l != 0:
  6. continue
  7. for i in range(last // l):
  8. if arr[0:l] != arr[l * i: l * (i + 1)]:
  9. break
  10. else:
  11. break
  12. return l
  13.  
  14. print(sectors([1,1,1,1,]))
Success #stdin #stdout 0.01s 9992KB
stdin
Standard input is empty
stdout
1