- Open
week07.pyin Thonny - Press Run (F5)
- Observe: You should see 3 squares appear in different positions
Try these changes one at a time:
-
Change square sizes
- Find the line:
draw_square(60) - Change 60 to 100 and run
- Try different sizes for each square
- Find the line:
-
Move squares to new positions
- Find:
t.goto(120, 0) - Change to:
t.goto(200, 100) - Experiment with different X and Y values
- Find:
-
Change turtle speed
- Find:
t.speed(6) - Try:
t.speed(1)(very slow) ort.speed(10)(fast) - Try:
t.speed(0)(instant - no animation)
- Find:
-
Add a fourth square
- Copy these lines after the third square:
t.penup(); t.goto(-200, -100); t.pendown() draw_square(75)
-
Draw a triangle
- Create a new function called
draw_triangle(size) - A triangle has 3 sides
- Each turn should be 120 degrees (360 ÷ 3)
- Hint:
def draw_triangle(size): for _ in range(3): t.forward(size) t.right(120)
- Create a new function called
-
Add colors
- Before drawing a shape, add:
t.color("blue") - Try different colors: "red", "green", "purple", "orange"
- Before drawing a shape, add:
-
Create a pattern
- Draw 5 squares in a row
- Make each one a different size
- Bonus: Use different colors for each
- Program runs without errors
- I can change square sizes
- I can move squares to different positions
- I added at least one new shape
- I understand what penup/pendown do