from math import sqrt
print('Hello world!')
Y=[2**k for k in range(1,11)]
print("Y=",Y)
P=[]
for i in range(1,11):
if i==1 :
P.append(0.15)
else :
if i==6 :
P.append(0.05)
else :
P.append(0.1)
print("P=",P)
def esperanceY() :
X=0
for i in range(0,10) :
X=X+Y[i]*P[i]
return X
print("espérance =",esperanceY())
def varianceY() :
X=0
for i in range(0,10):
X=X+P[i]*(Y[i]-esperanceY())**2
return X
print("variance =",varianceY())
def ecarttypeY() :
X=sqrt(varianceY())
return X
print("écart type =",round(ecarttypeY(),2))
To embed this project on your website, copy the following code and paste it into your website's HTML: