triverse.py

Created by schraf

Created on July 22, 2024

311 Bytes

Dans le script ci-dessous je n’utilise que “lt” (left) pour orienter la tortue et “fd” pour la faire avancer. La lettre “m” permet d’indiquer qu’il faut mémoriser la position actuelle et “r” qu’il faut retourner à cette position.


from turtle import *

d = 40
pensize(2)

def gt(x,y):
 penup()
 goto(x,y)
 pendown()    

gt(-3*d,0)

for _ in range(3): 
 for k in "0m1211001122r01m01r0r55":
  if k=='m': x,y=position()
  elif k=='r': gt(x,y)
  else:
   lt(60*int(k))
   fd(d)
 penup()
 fd(d)
 lt(180)
 pendown()
 
hideturtle()

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.