def setup():
n=[40,-70,-50,20,-73,79,-61,-77]
print('sum of positive values in array is ',calpositiveSum(n))
find_positive(n)
def calpositiveSum(n):
i=0
sums=0
while(i<len(n)):
if(n[i]>0):
sums=sums+n[i]
i=i+1
return sums
def find_positive(n):
i=0
count=0
while(i<len(n)):
if(n[i]>0):
count=count+1
print('the positive number is in index : ',i)
i=i+1
print('the number of positive number is',count)
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น