0 out of 464 challenges solved
Write a function `tuple_to_dict` that takes a tuple of even length as input and converts it into a dictionary. The function should use adjacent elements in the tuple as key-value pairs. #### Example Usage ```python [main.nopy] print(tuple_to_dict((1, 5, 7, 10, 13, 5))) # Output: {1: 5, 7: 10, 13: 5} print(tuple_to_dict((2, 4, 6, 8))) # Output: {2: 4, 6: 8} ``` #### Constraints - The input tuple will always have an even number of elements. - The function should return a dictionary where the first element of each pair is the key and the second is the value.
def tuple_to_dict(input_tuple): """ Convert a tuple into a dictionary using adjacent elements as key-value pairs. Args: input_tuple (tuple): A tuple with an even number of elements. Returns: dict: A dictionary with adjacent elements as key-value pairs. """ # Placeholder for the solution pass