Lesson 5: Colours and fills
Cette page nécessite un navigateur récent (avec support SharedArrayBuffer). Veuillez mettre à jour Chrome, Edge, Firefox ou Safari vers la dernière version.
English
Colour the pen
pencolor("red")changes the line colour.fillcolor("yellow")sets the colour inside a shape.- Draw the shape between
begin_fill()andend_fill()to colour it in.
Words for this lesson
| Word | Meaning |
|---|---|
| pen colour | the colour of the lines |
| fill | colour the inside of a closed shape |
| list | many values in one variable: ["red", "blue"] |
English
A filled square
import turtle
turtle.pencolor("blue")
turtle.fillcolor("yellow")
turtle.begin_fill()
for i in range(4):
turtle.forward(100)
turtle.left(90)
turtle.end_fill()
Difficulté 2/5 · 140 pièces + un petit bonus lors de la première réussite aujourd'hui
Draw a triangle with sides of 150 steps, filled with the colour orange.
Cliquez sur Exécuter pour voir le résultat ici.
Difficulté 2/5 · 140 pièces + un petit bonus lors de la première réussite aujourd'hui
Draw a hexagon with sides of 80 steps. Give each side a different colour from this list: colors = ["red", "orange", "yellow", "green", "blue", "purple"].
Cliquez sur Exécuter pour voir le résultat ici.