"""
Lecture 11 - You Try: sum_and_prod
Returns a tuple of (sum, product) for a list of numbers.
"""


def sum_and_prod(L):
    """
    - L is a list of numbers
    - Return a tuple where the first value is the sum of all
      elements in L and the second value is the product of all
      elements in L
    """
    total = 0
    product = 1
    for num in L:
        total += num
        product *= num
    return (total, product)


# Test calls
print(sum_and_prod([1, 2, 3, 4]))    # (10, 24)
print(sum_and_prod([5]))              # (5, 5)
print(sum_and_prod([2, 3, 5]))        # (10, 30)
