Posts

Showing posts from February, 2021

Python Turtle

Image
The Python turtle library consists of all important methods and functions  that  we will need to create our designs and images. Import the turtle library  using  the following command.     import turtle We can access all methods and functions. First, we need to create a dedicated window where we carry out each drawing command. We can do it by initializing a variable for it.     s=turtle.getscreen() Example: import turtle s=turtle.getscreen()     #Creating Turtle Screen turtle.mainloop()          #To stop the screen to display Output: Turtle Motion: The turtle can move forward and backward in direction that it's facing. Let's see the following functions. forward(disatnce) or turtle.fd(distance) -  It moves the turtle in the forward direction by a certain distance. It takes one parameter distance,  which can be an integer or float.           Example:    ...