E. right()/left(): Rotating
๐ฏ Learning Goals
By the end of this lesson, you'll be able to:
- โ
right(),left()You can use a function - โ Understands the concept of angles
- โ Understands the turtle's direction
โก 30-Second Challenge
Run the code below and try changing the angle!
Did it work? Let's learn more about it below!
Core Concepts
Rotation function
| Function | Direction | Description |
|---|---|---|
right(90) |
โป | Turn right 90 degrees (clockwise) |
left(90) |
โบ | Turn left 90 degrees (counterclockwise) |
What Is an Angle?
| Angle | Meaning | Example |
|---|---|---|
| 90 degrees | Right angle | ใด Shape |
| 180 degrees | Half a turn | Turn around |
| 360 degrees | One full turn | In place |
Direction reference
90ยฐ (north/up)
โ
180ยฐ (west/left) โ ๐ข โ 0ยฐ (east/right) โ starting direction
โ
270ยฐ (south/down)
๐งญ The turtle starts facing east
By default, the turtle Right (east, 0 degrees)is facing it.
Try Visual Coding
Mission
Try moving forward โ turning right 90 degrees โ moving forward!
# Add blocks and the Python code will show up here...
Add blocks and the flowchart will show up here...
Example Code
import turtle
t = turtle.Turtle()
t.shape("turtle")
t.forward(100) # Forward
t.right(90) # Turn 90 degrees to the right
t.forward(100) # Forward again
What Happens
A flipped version of the 'ใด' shape gets drawn!
Quiz
Quiz: Direction of Rotation
Which direction does `right(90)` turn?
Show Answer
Answer: C) Clockwise (right)
right()turns clockwise.
left()turns counterclockwise.
๐ง Debug Clinic
Problem: it rotated, but no line is drawn!
โ Correct Code
Fix: after rotatingforward() Add!
Try Coding It Yourself
Take what you learned with the blocks and write it yourself in Python code!
Rotating
t.right()and t.left()Rotate the turtle with it.
Example Answer
Result: The turtle goes forward, then turns right to draw the ใฑ shape!
Turning to the left
t.left(90)Try turning left with this too!
Rotation function practice
- Turn right:
t.right(90) - Turn left:
t.left(90) - A right angle is 90degrees
Review Checklist
- [ ]
right()andleft()I can explain the difference - [ ] You know what 90 degrees, 180 degrees, and 360 degrees each mean
- [ ] You know which direction the turtle starts facing (right/east)
๐งฉ Key Takeaways
What you learned in this lesson:
| Concept | Description |
|---|---|
| right(n) | Turn right n degrees (clockwise) |
| left(n) | Turn left n degrees (counterclockwise) |
| 90 degrees | Right angle (ใด shape) |
| Move after rotating | Only the direction changes, no line is drawn |