0 out of 464 challenges solved
Write a Python function `positive_ratio(nums)` that takes a list of integers `nums` and returns the ratio of positive numbers in the list. The ratio should be rounded to two decimal places. #### Example Usage ```python [main.nopy] positive_ratio([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8]) # Output: 0.54 positive_ratio([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8]) # Output: 0.69 positive_ratio([2, 4, -6, -9, 11, -12, 14, -5, 17]) # Output: 0.56 ``` #### Constraints - The input list will contain at least one integer. - The function should handle both positive and negative integers, as well as zeros.
def positive_ratio(nums): """ Calculate the ratio of positive numbers in the list. Args: nums (list): A list of integers. Returns: float: The ratio of positive numbers rounded to two decimal places. """ # Placeholder for the solution pass