ch10_algorithmique12.py

Created by manuel-eleve-1re-indice2019

Created on November 05, 2019

334 Bytes


from random import random

def aire_sous_parabole(n):
    S=0
    for k in range(n):
        x = random()
        y = random()
        if y<x**2:
            S=S+1
    return S/n


#Exécution de la fonction
print(aire_sous_parabole(100))
print(aire_sous_parabole(10000))
print(aire_sous_parabole(1000000))