Calculates the product sum of an array. Args: array (List[Union[int, List]]): The array of integers and nested lists. Returns: int: The product sum of the array. Examples: >>> product_sum_array([1, 2, 3]) 6 >>> product_sum_array([1, [2, 3]]
(array: list[int | list])
| 65 | |
| 66 | |
| 67 | def product_sum_array(array: list[int | list]) -> int: |
| 68 | """ |
| 69 | Calculates the product sum of an array. |
| 70 | |
| 71 | Args: |
| 72 | array (List[Union[int, List]]): The array of integers and nested lists. |
| 73 | |
| 74 | Returns: |
| 75 | int: The product sum of the array. |
| 76 | |
| 77 | Examples: |
| 78 | >>> product_sum_array([1, 2, 3]) |
| 79 | 6 |
| 80 | >>> product_sum_array([1, [2, 3]]) |
| 81 | 11 |
| 82 | >>> product_sum_array([1, [2, [3, 4]]]) |
| 83 | 47 |
| 84 | >>> product_sum_array([0]) |
| 85 | 0 |
| 86 | >>> product_sum_array([-3.5, [1, [0.5]]]) |
| 87 | 1.5 |
| 88 | >>> product_sum_array([1, -2]) |
| 89 | -1 |
| 90 | |
| 91 | """ |
| 92 | return product_sum(array, 1) |
| 93 | |
| 94 | |
| 95 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected