51
Question Write a method EvenSum(NUMBERS) to add those values in the tuple of NUMBERS which are even.
def EvenSum(NUMBERS):
even_sum = 0
for number in NUMBERS:
if number % 2 == 0:
even_sum += number
return even_sum
n = eval(input("Enter the tuple: "))
result = EvenSum(n)
print("The sum of even numbers in the tuple is:", result)Enter the tuple: (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
The sum of even numbers in the tuple is: 30