turtle.right() method in Python

The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support.

turtle.right()

The turtle.right() method is used to change the direction of the turtle by the value of the argument that it takes. It gives the moving of the head of the turtle in a direction. 

Syntax:

turtle.right(angle)

The argument it takes is angle { a number (integer or float) }. So, it turns turtle right by angle units. (Units are by default degrees but can be set via the degrees() and radians() functions.) Angle orientation depends on the mode.

Below is the implementation of the above method with some examples :



Example 1:

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# importing package
import turtle
  
  
# move the turtle forward by 
# 100 unit distance in the
# direction of head of turtle
turtle.forward(100)
  
# change the direction of turtle
# by 90 degrees to the right.
turtle.right(90)
  
# move the turtle forward by
# 100 unit distance in the 
# direction of head of turtle
turtle.forward(100)

chevron_right


Output :

Example 2:

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# importing package
import turtle
  
  
# Loop for pattern
for i in range(10):
    
  # move the turtle forward by 
  # 100+variable unit distance
  # in the direction of head of turtle
  turtle.forward(100+10*i)
    
  # change the direction of turtle
  # by 90 degrees to the right.
  turtle.right(90)

chevron_right


Output :


Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.