heron.py

Created by florian-allard

Created on June 02, 2020

125 Bytes

Affiche les 10 premiers termes de la suite de Héron d’Alexandrie, avec comme premier terme 2 et comme valeur de a, une valeur demandée à l’utilisateur. Cette suite tend vers la racine carrée du nombre a.


from math import *
def heron():
  a=float(input("a"))
  u=2
  for i in range(10):
    u=1/2*(u+a/u)
    print(u)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.