Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python3
- import os
- import sys
- #
- # Complete the plusMinus function below.
- #
- def plusMinus(arr):
- #
- # Write your code here.
- #
- n = len(arr)
- count_z = 0
- count_p = 0
- count_n = 0
- for x in range(0,n):
- if arr[x] == 0:
- count_z += 1
- elif arr[x] > 0:
- count_p += 1
- else:
- count_n += 1
- per_z = "{:.6f}".format(count_z/n)
- per_p = "{:.6f}".format(count_p/n)
- per_n = "{:.6f}".format(count_n/n)
- print (per_p)
- print (per_n)
- print (per_z)
- if __name__ == '__main__':
- n = int(input())
- arr = list(map(int, input().rstrip().split()))
- plusMinus(arr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement