Lesson 7: Spirals
หน้านี้ต้องใช้เบราว์เซอร์ล่าสุด (รองรับ SharedArrayBuffer) กรุณาอัปเดต Chrome, Edge, Firefox หรือ Safari เป็นเวอร์ชันล่าสุด
English
A line that grows
- Use the loop variable in the drawing:
forward(i)gets longer each time. - Turn the same angle each time, and a spiral appears.
Words for this lesson
| Word | Meaning |
|---|---|
| spiral | a line that goes round and round, further out each time |
| loop variable | the name after for; it changes each time |
English
A square spiral
import turtle
for i in range(40):
turtle.forward(i * 5)
turtle.left(90)
- Try
left(91)orleft(120)for new patterns.
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Draw a spiral of 30 lines. Each line is 4 steps longer than the line before. Turn left(90) each time.
คลิก Run เพื่อดูผลลัพธ์ที่นี่
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Draw a spiral of 60 lines that turns left(121), each line 3 steps longer than the last. Change the pen colour each time from the list ["red", "gold", "blue"].
คลิก Run เพื่อดูผลลัพธ์ที่นี่