Lesson 5: Colours and fills
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
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()
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Draw a triangle with sides of 150 steps, filled with the colour orange.
点击“运行”查看此处输出。
难度 2/5 · 今日首次完成可获 140 金币及少量额外奖励
Draw a hexagon with sides of 80 steps. Give each side a different colour from this list: colors = ["red", "orange", "yellow", "green", "blue", "purple"].
点击“运行”查看此处输出。