fork download
  1. index_max = [5, 5, 5, 5, 6, 7, 14, 15, 16, 16, 16, 16, 18, 18, 32, 32, 34, 34, 34, 34, 35, 38, 42, 42, 42, 42, 45]
  2. pattern_width = 4
  3. final_list = []
  4.  
  5. for i in range(len(index_max) - pattern_width):
  6. temp = index_max[i:i + pattern_width]
  7. s = set(temp)
  8. if len(s) == 1:
  9. final_list.append(temp[0])
  10.  
  11. print(final_list)
Success #stdin #stdout 0.04s 64412KB
stdin
Standard input is empty
stdout
[5, 16, 34, 42]