SSB Moknine High School 1 erasecondary year
Module Turtle
TP2
Activity 1:
from turtle import * from turtle import *
pensize(2) pensize(2)
forward(100) Block of ………………………………….
right(90) treatments that are forward(100)
forward(100) on on on on right(90)
right(90)
can replace it
forward(100)
right(90) by ..........
forward(100)
Activity2 :
In a new window, write this code and save it under the name "[Link]".
from turtle import * Import all the commands from the turtle module
pensize(2) Increase the size of the pencil
up() Lift the pencil
goto(-300,-180) Change the pencil coordinates
down() ………………… the pencil
for i in range(4): …………………. the treatments 4 times
forward(50) ............ from a distance of 50
right(90) …………………. to the right of 90°
Modify the previous code:
from turtle import * Result obtained
pen size(2)
up()
goto(-300,-180)
down()
begin_fill()
fillcolor("blue")
for i in range(4):
forward(50)
right(90)
end_fill()
Professor: Karchoud Radhouane Page1
SSB Moknine High School 1 yearsecondary year
from turtle import *
pensize(2)
up()
goto(-200,-180)
down()
for i in range(4):
forward(50)
right(90)
up()
goto(-200,180)
down()
………………………………
………………..
………………..
up()
……………………..
down()
for i in range(4):
move forward 50
right(90)
………. Modify the code so that the squares are
…………………….
……………. fill in with a color (blue by
for i in range(4): example).
forward(50)
right(90)
up()
goto(0,-50)
down()
color("grey")
……………….
Work to be done:
Draw an star with the Turtle module with a red outline and fill.
The angle between two segments is equal to 144.
Code to write:
Prof : Karchoud Radhouane Page2