Advertisement
Guest User

Untitled

a guest
Dec 11th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15]
  2. y = [0, 2, 3, 0, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14]
  3. z = [-1]
  4. r = [1]
  5. a = [0,0,0,0,0,0,0,0,0]
  6.  
  7. from copy import *
  8.  
  9. def count_positives_sum_negatives(arr):
  10. dub = copy(arr)
  11. out = []
  12. if not arr:
  13. return []
  14. if sum([z for z in dub if z >= 0]) == 0:
  15. return [0,0]
  16. else:
  17. calc1 = len([i for i in dub if i > 0])
  18. out.append(calc1)
  19. calc2 = sum([x for x in dub if x < 0])
  20. out.append(calc2)
  21. return out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement