0 out of 464 challenges solved
Write a Python function `multiply_elements` that takes as input a tuple of numbers `(t_1, t_2, ..., t_{N+1})` and returns a tuple of length `N` where the `i-th` element of the tuple is equal to `t_i * t_{i+1}`. #### Example Usage ```python [main.nopy] print(multiply_elements((1, 5, 7, 8, 10))) # Output: (5, 35, 56, 80) print(multiply_elements((2, 4, 5, 6, 7))) # Output: (8, 20, 30, 42) print(multiply_elements((12, 13, 14, 9, 15))) # Output: (156, 182, 126, 135) print(multiply_elements((12,))) # Output: () ``` #### Constraints - The input tuple will always contain at least one number. - The function should handle tuples of varying lengths gracefully.
def multiply_elements(input_tuple): """ Given a tuple of numbers, return a new tuple where each element is the product of consecutive elements in the input tuple. Args: input_tuple (tuple): A tuple of numbers. Returns: tuple: A tuple containing the products of consecutive elements. """ # Placeholder for the solution pass