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