from array import * a = array("i",[1,2,3,4,5,6]) d = [] b = 0 for c in a: if c%2 != 0 : c = c + b e = d.append(c) print(sum(d))