0 out of 464 challenges solved
Write a function `index_multiplication` that takes two tuples of tuples as input and returns a new tuple of tuples. Each inner tuple in the result should contain the element-wise product of the corresponding inner tuples from the input. #### Example Usage ```python [main.nopy] result = index_multiplication(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) print(result) # Output: ((6, 21), (12, 45), (2, 9), (7, 30)) ``` #### Constraints - The input tuples will always have the same structure and dimensions. - Each inner tuple will contain integers. - The function should handle any number of inner tuples and any length of inner tuples.
def index_multiplication(tuple1, tuple2):
"""
Perform index-wise multiplication of tuple elements in the given two tuples.
Args:
tuple1 (tuple of tuples): The first tuple of tuples.
tuple2 (tuple of tuples): The second tuple of tuples.
Returns:
tuple of tuples: A new tuple of tuples with index-wise multiplied elements.
"""
# Initialize the result tuple
result = ()
# Perform the index-wise multiplication
# Placeholder for implementation
return result