python sum conditions code example Example: sum with conditional python sum(i for i in array if array.index(i) % 2 == 0)