0 out of 464 challenges solved

Max Aggregate from Tuples

Write a Python function `max_aggregate` that takes a list of tuples as input. Each tuple contains a name (string) and a score (integer). The function should calculate the total score for each unique name and return the name with the highest total score along with their aggregate score as a tuple.

If there are multiple names with the same highest score, return any one of them.

#### Example Usage
```python [main.nopy]
# Input: List of tuples with names and scores
input_data = [
    ('Juan Whelan', 90),
    ('Sabah Colley', 88),
    ('Peter Nichols', 7),
    ('Juan Whelan', 122),
    ('Sabah Colley', 84)
]

# Expected Output: ('Juan Whelan', 212)
result = max_aggregate(input_data)
print(result)  # Output: ('Juan Whelan', 212)
```

#### Constraints
1. The input list will contain at least one tuple.
2. Each tuple will have exactly two elements: a string (name) and an integer (score).
3. Scores will be non-negative integers.
from collections import defaultdict

def max_aggregate(stdata):
    """
    Calculate the maximum aggregate score from a list of tuples.

    Args:
        stdata (list): A list of tuples where each tuple contains a name (str) and a score (int).

    Returns:
        tuple: A tuple containing the name with the highest aggregate score and the score itself.
    """
    # Placeholder for the solution
    pass