DiYane

List Statistics

Jul 28th, 2023
752
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. n = int(input())
  2. positives = []
  3. negatives = []
  4.  
  5. for i in range(n):
  6.     current_num = int(input())
  7.     if current_num >= 0:
  8.         positives.append(current_num)
  9.     else:
  10.         negatives.append(current_num)
  11.  
  12. print(positives)
  13. print(negatives)
  14. print(f"Count of positives: {len(positives)}")
  15. print(f"Sum of negatives: {sum(negatives)}")
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment