You are on page 1of 1

n=int(input("enter the number of elements in lists:"))

A=[]
for i in range(0,n):
a=int(input("element:"))
A.append(a)
sum1=0
sum2=0
for j in A:
if j>0:
sum1=sum1+j
else:
sum2=sum2+j
print("sum of all positive numbers:",sum1)
print("sum of all negative numbers;",sum2)

You might also like