dm11.py

Created by lamhassni-bilal

Created on May 19, 2023

1.79 KB

Script du DM du Lapin de Pâques


from math import*
from turtle import*
hideturtle()

def tete():
  penup()
  backward(45)
  left(90)
  backward(15)
  pendown()
  right(180)
  pensize(2)
  circle(45)
  
def oreille_gauche():
  penup()
  goto(-10,27)
  pendown()
  right(145)
  for i in range(4):
    forward(15)
    left(15)
  left(15)
  for i in range(20):
    forward(1)
    left(2)
  left(75)
  for i in range(4):
    forward(15)
    left(15)
  penup()
  goto(-15,25)
  pendown()
  left(100)
  for i in range(4):
    forward(10)
    left(20)
  left(75)
  for i in range(4):
    forward(11)
    left(35)
    
def oreille_droite():
  penup()
  goto(10,26)
  pendown()
  setheading(95)
  for i in range(4):
    forward(15)
    right(15)
  right(15)
  for i in range(20):
    forward(1)
    right(2)
  right(75)
  for i in range(4):
    forward(16)
    right(15)
  penup()
  goto(12,25)
  pendown()
  setheading(95)
  for i in range(4):
    forward(10)
    right(20)
  right(75)
  for i in range(4):
    forward(10)
    right(35)
    
def oreilles():
  oreille_gauche()
  oreille_droite()
  
def museau():
  penup()
  goto(2,-20)
  pendown()
  pensize(2)
  setheading(180)
  for i in range(3):
    forward(7)
    left(120)
  goto(-2,-25)
  setheading(270)
  circle(8,180)
  penup()
  goto(-18,-25)
  pendown()
  setheading(270)
  circle(8,180)
  
def yeux():
  setheading(135)
  for i in range(2):
    circle(10,90)
    circle(5,90)
    pensize(10)
  backward(5)
  circle(1)
  pensize(2)
    
def poils():
  setheading(155)
  for i in range(3):
    penup()
    goto(-35,-12-i*6)
    pendown()
    forward(20)
    left(25*(i+1))
  setheading(25)
  for i in range(3):
    penup()
    goto(35,-12-i*6)
    pendown()
    forward(20)
    right(25*(i+1))
  
tete()
oreilles()
museau()
penup()
goto(-10,0)
pendown()
yeux()
penup()
goto(25,0)
pendown()
yeux()
poils()

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.