tortue_2de_tp2.py

Created by jean-luc-poncin

Created on September 11, 2021

845 Bytes

Fonction qui trace un triangle équilatéral de côté variable. Fonction qui trace un carré de côté variable. Tracé de dessins utilisant ces deux fonctions.


from turtle import *

def te(cote):
    forward(cote)
    left(120)
    forward(cote)
    left(120)
    forward(cote)
    left(120)
    
def dessin2():
    te(40)
    te(70)
    te(100)

def dessin3():
    te(40)
    forward(40)
    te(50)
    forward(50)
    te(60)

def dessin4():
    te(60)
    left(120)
    te(80)
    left(120)
    te(100)
    
def carre(cote):
    forward(cote)
    left(90)
    forward(cote)
    left(90)
    forward(cote)
    left(90)
    forward(cote)
    left(90)

def dessin5():
    penup()
    left(180)
    forward(150)
    left(90)
    forward(100)
    left(90)
    pendown()
    carre(100)
    penup()
    forward(150)
    left(90)
    forward(100)
    right(90)
    pendown()
    carre(60)
    penup()
    forward(110)
    left(90)
    forward(60)
    right(90)
    pendown()
    carre(40)

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.