Lesson 1: First lines
Esta página precisa de um navegador recente (com suporte a SharedArrayBuffer). Por favor, atualize Chrome, Edge, Firefox ou Safari para a versão mais recente.
English
Meet the turtle
- In Python, a turtle is a small arrow with a pen.
- It walks on the screen and draws a line behind it.
- This is real Python: the same code works in IDLE on your computer at home.
Words for this lesson
| Word | Meaning |
|---|---|
| forward | walk ahead in the direction the turtle faces |
| left / right | turn on the spot, by an angle in degrees |
| degree | a full turn is 360 degrees; a corner of a square is 90 |
English
Walk and turn
forward(100)walks 100 steps.left(90)turns a quarter turn.- The turtle starts in the middle, looking right.
import turtle
turtle.forward(100)
turtle.left(90)
turtle.forward(50)
- Press Run: the turtle draws an L shape.
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Draw a square with sides of 100 steps. The turtle must end where it started.
Clique em Executar para ver a saída aqui.
Dificuldade 2/5 · Moedas 140 + pequeno bônus na primeira conclusão hoje
Draw a rectangle: 150 steps wide and 80 steps tall. End where you started.
Clique em Executar para ver a saída aqui.