Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = int(input())
- positive = []
- negative = []
- for i in range(num):
- n = int(input())
- if n >= 0:
- positive.append(n)
- else:
- negative.append(n)
- print(positive)
- print(negative)
- print(f'Count of positives: {len(positive)}')
- print(f'Sum of negatives: {sum(negative)}')
- Или :
- num = int(input())
- positive = []
- negative = []
- for i in range(num):
- n = int(input())
- positive.append(n) if n >= 0 else negative.append(n)
- print(f'{positive}\n{negative}\nCount of positives:'
- f' {len(positive)}\nSum of negatives: {sum(negative)}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement