Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. n = len(arr)
  2. count_z = 0
  3. count_p = 0
  4. count_n = 0
  5. for x in range(0,n):
  6. if arr[x] == 0:
  7. count_z += 1
  8. elif arr[x] > 0:
  9. count_p += 1
  10. else:
  11. count_n += 1
  12. per_z = "{:.6f}".format(count_z/n)
  13. per_p = "{:.6f}".format(count_p/n)
  14. per_n = "{:.6f}".format(count_n/n)
  15. print (per_p)
  16. print (per_n)
  17. print (per_z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement