Skip to content

E. right()/left(): Rotating

To the final mission: โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘ 50%


๐ŸŽฏ 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...
100 100 90 90 90


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!

โŒ Wrong Code

t.forward(100)
t.right(90)      # Just turns
Cause: you only rotated and didn't move

โœ… Correct Code

t.forward(100)
t.right(90)
t.forward(100)   # Turn, then move!
Fix: after rotating forward() 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
import turtle
t = turtle.Turtle()
t.shape('turtle')

t.forward(100)
t.right(90)
t.forward(100)

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()and left()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