Python Program to find the sum of tuple elements


In this program, you will learn how to find the sum of tuple elements in Python.


tuple1 = (10, 20, 30, 40)

Example: How to find the sum of tuple elements in Python

tuple1 = (10, 20, 30, 40)

print("Tuple values are :", tuple1)
s = 0

for i in tuple1:
    s = s + i

print("Sum of tuple elements : ", s)

Output:

Tuple values are : (10, 20, 30, 40)
Sum of tuple elements :  100