0 out of 464 challenges solved

Cumulative Sum of Tuple List

Write a Python function `cumulative_sum` that takes a list of tuples as input and returns the cumulative sum of all the values present in the tuples.

#### Example Usage:
```python [main.nopy]
print(cumulative_sum([(1, 3), (5, 6, 7), (2, 6)]))  # Output: 30
print(cumulative_sum([(2, 4), (6, 7, 8), (3, 7)]))  # Output: 37
print(cumulative_sum([(3, 5), (7, 8, 9), (4, 8)]))  # Output: 44
```

#### Constraints:
- The input will always be a list of tuples containing integers.
- The function should handle empty lists and tuples gracefully.
def cumulative_sum(tuple_list):
    """
    Calculate the cumulative sum of all values in a list of tuples.

    Args:
        tuple_list (list of tuples): A list where each element is a tuple of integers.

    Returns:
        int: The cumulative sum of all integers in the tuples.
    """
    # Initialize the cumulative sum
    total_sum = 0

    # Iterate through the list of tuples
    for tpl in tuple_list:
        # Add the sum of the current tuple to the total sum
        pass  # Replace this with the actual implementation

    return total_sum