0 out of 464 challenges solved
Write a function `subtract_elements` that takes in two tuples of numbers and returns a new tuple where each element is the result of subtracting the corresponding element of the second tuple from the first tuple. #### Example Usage ```python [main.nopy] result = subtract_elements((10, 4, 5), (2, 5, 18)) print(result) # Output: (8, -1, -13) result = subtract_elements((7, 18, 9), (10, 11, 12)) print(result) # Output: (-3, 7, -3) ``` #### Constraints - Both input tuples will have the same length. - The tuples will only contain numeric values (integers or floats).
def subtract_elements(tuple1, tuple2): """ Subtracts corresponding elements of two tuples. Args: tuple1 (tuple): The first tuple of numbers. tuple2 (tuple): The second tuple of numbers. Returns: tuple: A tuple containing the results of the subtraction. """ # Implement the subtraction logic here pass