1822. Sign of the Product of an Array - LeetCode
class Solution:
def arraySign(self, nums: list[int]) -> int:
sig = True
for num in nums:
if num == 0:
return 0
if num < 0:
sig = not sig
return int(sig or -1)