1064.Positives and Avarage in python
This is the solution of this problem in python:
a=float(input())
b=float(input())
c=float(input())
d=float(input())
e=float(input())
f=float(input())
count=0
if(a>0):
count+=1
total=a
if(b>0):
count+=1
total=total+b
if(c>0):
count+=1
total=total+c
if(d>0):
count+=1
total=total+d
if(e>0):
count+=1
total=total+e
if(f>0):
count+=1
total=total+f
avarage=total/count
print("%i valores positivos"%count)
print("%.1f"%avarage)
No comments