turtle.backward() 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.backward()
The turtle.backward() method is used to move the turtle backward by the value of the argument that it takes. It gives a line on moving to another position or direction with backward motion.
Syntax:
turtle.backward(distance)
The argument it takes is distance { a number (integer or float) }. So, it moves the turtle backward by the specified distance, in the opposite direction the turtle is headed. Below is the implementation of the above method with some examples :
Example 1:
Python3
# importing packagesimport turtle # move turtle backward with # distance = 100turtle.backward(100) |
Output :

Example 2:
Python3
# importing packageimport turtle # move the turtle backward by 50turtle.backward(50) # change the directionturtle.right(90) # move the turtle backward by 50 againturtle.backward(50) |
Output :







Please Login to comment...