Last active
September 13, 2023 03:45
-
-
Save codeperfectplus/9dc3777e1fbf65357641748eb7890f32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plusMinus(arr): | |
countPositive = 0 | |
countNegative = 0 | |
n = len(arr) | |
for i in range(n): | |
if arr[i] > 0: | |
countPositive += 1 | |
elif arr[i] < 0: | |
countNegative += 1 | |
countZero = n - countPositive-countNegative | |
print(countPositive/n) | |
print(countNegative/n) | |
print(countZero/n) | |
if __name__ == '__main__': | |
n = int(input()) | |
arr = list(map(int, input().rstrip().split())) | |
plusMinus(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment