0 out of 464 challenges solved
Write a Python function `concatenate_tuple` that takes a tuple of elements and concatenates them into a single string, separated by a specified delimiter. The delimiter should be a hyphen (`-`). #### Function Signature ```python [main.nopy] def concatenate_tuple(elements: tuple) -> str: pass ``` #### Input - A tuple `elements` containing elements of any type (e.g., `("ID", "is", 4, "UTS")`). #### Output - A string where all elements of the tuple are concatenated, separated by the delimiter `-`. #### Example Usage ```python [main.nopy] concatenate_tuple(("ID", "is", 4, "UTS")) # Output: 'ID-is-4-UTS' concatenate_tuple(("QWE", "is", 4, "RTY")) # Output: 'QWE-is-4-RTY' concatenate_tuple(("ZEN", "is", 4, "OP")) # Output: 'ZEN-is-4-OP' ``` #### Constraints - The function should handle tuples with elements of mixed types (e.g., strings, integers). - The delimiter is always a hyphen (`-`).
def concatenate_tuple(elements: tuple) -> str: """ Concatenate elements of a tuple into a single string separated by a hyphen. Args: elements (tuple): A tuple containing elements of any type. Returns: str: A string with all elements concatenated, separated by a hyphen. """ # Implement the function logic here pass