Lesson 3: Any shape
이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
The 360 rule
- To draw a shape with
nequal sides, turn360 / ndegrees at each corner. - Square: 360 / 4 = 90. Triangle: 360 / 3 = 120.
Words for this lesson
| Word | Meaning |
|---|---|
| polygon | a closed shape with straight sides |
| hexagon | a polygon with 6 sides |
| variable | a name for a value, like sides = 6 |
English
Change one number
import turtle
sides = 5
for i in range(sides):
turtle.forward(80)
turtle.left(360 / sides)
- Change
sidesto 6, 8 or 10. The loop does the rest.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Draw a hexagon: 6 equal sides of 80 steps. Use a loop and the 360 rule.
출력을 보려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Draw an octagon (8 sides) with sides of 50 steps. A stop sign has this shape.
출력을 보려면 '실행'을 클릭하세요.