fork download
  1. from itertools import cycle
  2. from operator import sub
  3.  
  4.  
  5. a = [2,1,2,3,2,3,4,3,4,5,4,5]
  6. b = [1,0,1]
  7. r = list(map(sub, a, cycle(b)))
  8. print(r)
  9.  
Success #stdin #stdout 0.1s 10088KB
stdin
Standard input is empty
stdout
[1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]