It is used to turn the turtle left.
Ex- left(90) , lt(90)
- setposition() or setpos()
It is used to set the position of the turtle.
we have to give two arguments to the function.
(x,y) value of both x and y,
Ex- setposition(10,20) , setpos(20,-10)
It is used to send the turtle to the given coordinates.
we have to pass the value of X and Y.
Ex- goto(10,5)
It is used to set the position of the x.
Ex- setx(4)
It is used to set the position of the y.
Ex- sety(8)
It is used to send the turtle to the origin(0,0).
Ex - home()
It is used to create the dot of given arguments.
we have to give two argument size and color of the dot.
Ex-dot(10,"red")
it is used for setting the speed of the turtle.
0- highest speed of the turtle.
10 - high speed of the turtle.
1- slowest speed of the turtle.
Ex- speed(0)
Tell State Of Turtle :
It returns the coordinates of the turtle.
Ex- position() or pos()
>>(1,2,1).
It returns the value of x coordinate.
Ex- xcor()
>>10.
It returns the value of the y coordinate.
Ex-ycor()
>>5.
It returns the distance of the coordinate from the origin.
Ex- distance(6,8)
>>10
Sample Programs Using Basic Functions
import turtle
for i in range (4):
turtle.fd(100)
turtle.rt(90)
turtle.mainloop()
- Output
import turtle
for i in range (360):
turtle.fd(2)
turtle.rt(1)
turtle.mainloop()