Lesson 1: First lines
このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
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.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Draw a square with sides of 100 steps. The turtle must end where it started.
実行ボタンをクリックして出力を確認してください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Draw a rectangle: 150 steps wide and 80 steps tall. End where you started.
実行ボタンをクリックして出力を確認してください。