17 Sep turtle.right() function in Python
The turtle.right() function in Python rotates the turtle clockwise (right) by a specified angle. This only changes the turtle’s heading, not its position.
Syntax: turtle.right(angle)
Parameters: angle: a number (integer or float) representing the degrees to turn.
Let us see an example to implement the turtle.right() function in Python:
Demo4.py
# turtle.right() function in Python # Code by Studyopedia import turtle window = turtle.Screen() t = turtle.Turtle() t.forward(100) t.right(90) # Turn right 90 degrees t.forward(100) window.exitonclick()
The following is the output:

In the above code, we followed the below steps:
- Import the module: import turtle loads Python’s turtle graphics library for simple drawing.
- Create the screen: window = turtle.Screen() opens the drawing window.
- Create the turtle: t = turtle.Turtle() makes a turtle (the pen) you control.
- Move forward: t.forward(100) draws a 100-unit line in the current direction.
- Turn right: t.right(90) rotates the turtle 90 degrees clockwise without moving.
- Move forward again: t.forward(100) draws another 100-unit line in the new direction, forming an “┘” shape.
- Close on click: window.exitonclick() keeps the window open until you click, then closes it.
If you liked the tutorial, spread the word and share the link and our website, Studyopedia, with others.
For Videos, Join Our YouTube Channel: Join Now
Read More:
- OpenCV Tutorial
- Python Tutorial
- NumPy Tutorial
- Pandas Tutorial
- Matplotlib Tutorial
- Generative AI Tutorial
- LangChain Tutorial
- RAG Tutorial
- Machine Learning Tutorial
- Deep Learning Tutorial
- Ollama Tutorial
- Retrieval Augmented Generation (RAG) Tutorial
- Copilot Tutorial
- Gemini Tutorial
- ChatGPT Tutorial
No Comments