Logo Les Interros des Lycées
suites-histoire-de-moyennes.py
Programme Python de l'Interros des Lycées
a,b,N = -1,-1,0
while a<0:
    a = float(input("Entrez un réel a > 0 : "))
while b<0:
    b = float(input("Entrez un réel b > 0 : "))
while N == 0:
    N = int(input("Entrez un entier N non nul : "))
u,v,n = a,b,0
while n < N:
    n += 1
    u = (a+b)/2
    v = ((a*a+b*b)/2)**0.5
    a,b = u,v
print("u = ",u," et v = ",v)