turtle.forward() method in Python-Turtle
Last Updated :
16 Jul, 2020
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
import turtle
turtle.forward( 100 )
|
Output :
Example 2:
Python3
import turtle
turtle.forward( 50 )
turtle.right( 90 )
turtle.forward( 50 )
|
Output :