Robotics & Artificial Intelligence

Write a Python program to add all the elements of a tuple.

Python Control Flow

1 Like

Answer

t = (10, 20, 30, 40)
s = 0
for i in t:
    s = s + i
print("Sum of elements of the tuple is:", s)

Output

Sum of elements of the tuple is: 100

Answered By

3 Likes


Related Questions