0 out of 464 challenges solved
Write a Python function `unique_product` that calculates the product of all unique numbers in a given list. The function should remove duplicate numbers from the list and then compute the product of the remaining numbers. #### Example Usage ```python [main.nopy] print(unique_product([10, 20, 30, 40, 20, 50, 60, 40])) # Output: 720000000 print(unique_product([1, 2, 3, 1])) # Output: 6 print(unique_product([7, 8, 9, 0, 1, 1])) # Output: 0 ``` #### Constraints - The input list will contain integers. - The list may contain duplicate values. - The product of the numbers will not exceed the range of a Python integer.
def unique_product(list_data): """ Calculate the product of unique numbers in the given list. Args: list_data (list): A list of integers. Returns: int: The product of unique numbers. """ # Convert the list to a set to remove duplicates # Initialize the product to 1 # Iterate through the unique numbers and calculate the product pass