rac2.py

Created by schraf

Created on April 19, 2023

260 Bytes

Sur une idée de Vincent Pantaloni

But : Trouver des valeurs approchées de √2 sous forme de fractions.

Vous devriez trouver successivement 4 / 3, 7 / 5, 10 / 7, 17 / 12…

√2 étant irrationnel, aucun des coins des carreaux supérieurs ne tombera exactement sur un des coins des carreaux inférieurs.


import turtle

t = turtle
data = (45, (90, -90)), (0,(-90,-90,90,90))

for d in data:
 t.penup()
 t.goto(-160,0)
 t.pendown()
 t.setheading(0)
 i = 0
 while t.position()[0] < 160:
  t.left(d[0] if i == 0 else d[1][i % len(d[1])])
  t.fd(8)
  i += 1

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.