fork download
  1. def compare_consecutive_cols(lst):
  2. res = [0 for i in xrange(len(lst[0]) / 2)]
  3. for i in xrange(len(lst)):
  4. for j in xrange(0, len(lst[i]), 2):
  5. if lst[i][j] == lst[i][j+1]:
  6. res[j / 2] += 1
  7. return res
  8.  
  9. A = [[1, 1, 1, 0, 1, 0], [0, 0, 0, 0, 0, 1]]
  10. print compare_consecutive_cols(A)
  11.  
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
[2, 1, 0]