fork download
  1. from random import randint
  2.  
  3. n = int(input('Введите n'))
  4. m = int(input('Введите m'))
  5.  
  6. arr = [[randint(-100, 100) for j in range(m)] for i in range(n)]
  7. sum_below_zero = 0
  8. sum_above_zero = 0
  9. cnt_even = 0
  10. cnt_odd = 0
  11.  
  12. print("\n\n", arr)
  13.  
  14. for x in arr:
  15. for y in x:
  16. if y < 0:
  17. sum_below_zero += y
  18. else:
  19. if y % 2 == 0:
  20. cnt_even += 1
  21. else:
  22. cnt_odd += 1
  23. sum_above_zero += y
  24.  
  25. print("\n\n", sum_below_zero, ' ', sum_above_zero, ' ', cnt_even, ' ', cnt_odd)
Success #stdin #stdout 0.06s 11984KB
stdin
3
4
stdout
Введите nВведите m

 [[3, 35, -7, -10], [81, 14, -25, 4], [-49, 37, -7, 57]]


 -98   213   2   5