Python Program to find the sum of all even numbers from a tuple


In this program, you will learn how to find the sum of all even numbers from a tuple in Python.


tuple1 = (2, 3, 4, 5, 6, 7)

Example: How to find the sum of all even numbers from a tuple in Python

tuple1 = (2, 3, 4, 5, 6, 7)
s = 0

for i in tuple1:
    if i % 2 == 0:
        s = s + i

print("Sum of all even numbers : ", s)

Output:

Sum of all even numbers :  12