• Aucun résultat trouvé

(1)# interro_11_2020_Irwin-Hall.py 01| from random import random 02| from math import * 03| 04| nb_essais def test

N/A
N/A
Protected

Academic year: 2022

Partager "(1)# interro_11_2020_Irwin-Hall.py 01| from random import random 02| from math import * 03| 04| nb_essais def test"

Copied!
1
0
0

Texte intégral

(1)

# interro_11_2020_Irwin-Hall.py

01| from random import random 02| from math import *

03|

04| nb_essais = 10**6 05|

06| def test():

07| s = 0 08| n = 0

09| while s < 1/2:

10| s += random() 11| n += 1

12| return n 13|

14| total = 0

15| for k in range(nb_essais):

16| total += test() 17|

18| print(total / nb_essais) 19| print(sqrt(exp(1))) 20|

21| # 1.6487...

1

Références

Documents relatifs

OilEd After fixing some issues on the SemTalk DAML import, a subset of the model could be imported.. The OildEd

[r]

On rappelle la 2 ème loi de Képler : le rayon vecteur OM - reliant le soleil à une planète - balaie des aires égales pendant des durées égales.. Par conséquent, on peut dire

[r]

This article examines the peculiarities of preparing for import test questions of the most commonly used types – “True/False”, “Multiple Choice” (“one of many” and “many of

Octave is a numerical linear algebra system (https://www.gnu.org/software/octave/), and function read.octave in package foreign (https://CRAN.R-project.org/package=foreign) can read

[r]

ƒ Obtenir des outils d'aide à la construction d'activités utilisables en classe ; échanger avec d'autres collègues ; avoir une aide pour obtenir des moyens dans mon collège.. ƒ