0 out of 464 challenges solved

Apply Format to List

Write a function `apply_format_to_list(elements, format_string)` that takes a list of elements and a format string, and returns a new list where the format string is applied to each element in the input list.

The format string should use Python's `str.format` syntax, where `{}` is replaced by the corresponding element from the list.

#### Example Usage:
```python [main.nopy]
apply_format_to_list([1, 2, 3], "Item: {}")
# Output: ["Item: 1", "Item: 2", "Item: 3"]

apply_format_to_list(["a", "b", "c"], "Letter: {}")
# Output: ["Letter: a", "Letter: b", "Letter: c"]
```

#### Constraints:
- The input list can contain any type of elements that can be converted to a string.
- The format string will always contain exactly one `{}` placeholder.
def apply_format_to_list(elements, format_string):
    """
    Apply a format string to each element in a list.

    Args:
        elements (list): A list of elements to format.
        format_string (str): A format string containing a single `{}` placeholder.

    Returns:
        list: A new list with the formatted strings.
    """
    # Replace the following line with your implementation
    pass