jeudi 27 mai 2021

How to average data with an exclusion criterion?

this is the expected input and output:enter image description here and this is what I got with the following code: enter image description here

c = float(input())
cant = 1
suma = 0
i = 0

while c > 0.053:
    suma += c
    cant += 1
    c = float(input())

if c > 2.049:
    a = c
    prom = (suma-a)/cant 
else:
    prom = suma/cant

print(cant)

print('{0:.2f} '.format(prom))

Aucun commentaire:

Enregistrer un commentaire