turtle.forward() method in Python-Turtle

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.forward()

The turtle.forward() method is used to move the turtle forward by the value of the argument that it takes. It gives a line on moving to another position or direction. 

turtle.forward(distance)

The argument it takes is distance { a number (integer or float) }. So, it moves the turtle forward by the specified distance, in the direction the turtle is headed.

Below is the implementation of above method with some examples :

Example 1:



Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# importing packages
import turtle
  
# move turtle forward with 
# distance = 100
turtle.forward(100)

chevron_right


Output :

Example 2:

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# importing package
import turtle
  
  
# move the turtle forward by 50
turtle.forward(50)
  
# change the direction
turtle.right(90)
  
# move the turtle forward by 50 again
turtle.forward(50)

chevron_right


Output :

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.