Challenge for Functions


The following function sums the even numbers of its parameters:

def sumEven(*vars):
    sum = 0
    for n in vars:
        if n%2==0:
            sum += n 
    return sum

For example, sumEven(2,3,4) would return 6.

You have a tuple named tup. Write one line of code (13 characters) that passes tup to sumEven() so it returns the sum of it's even numbers.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us
Sign in or email us at [email protected]