ch10_ex51_prof.py

Created by manuel-2de-indice2019

Created on October 14, 2019

240 Bytes


from math import sqrt

def fonction(x1,n1,x2,n2,x3,n3):
    n = n1+n2+n3
    m = (n1*x1+n2*x2+n3*x3)/n
    v = (n1*(x1-m)**2+n2*(x2-m)**2+n3*(x3-m)**2)/n
    e = sqrt(v)
    return(m,e)

print(fonction(2,11,4,16,6,13))