Friday, December 27, 2024
Google search engine
HomeLanguagesturtle.backward() method in Python

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 packages
import turtle
  
  
# move turtle backward with 
# distance = 100
turtle.backward(100)


Output :

Example 2:

Python3




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


Output :

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments