get position of turtle python

Solutions on MaxInterview for get position of turtle python by the best coders in the world

showing results for - "get position of turtle python"
César
07 Nov 2019
1import turtle
2t = turtle.Turtle()
3
4turtles_position = t.pos() # Will return a tuple that includes both X and Y
5# coordinates of the turtle named t respectively, E.G (200,600).
6
7turtles_positionX = t.xcor() # Will return a float value of the turtle's
8# X position.
9
10turtles_positionY = t.ycor() # Will return a float value of the turtle's
11# Y position.
12
13###############################################################
14# Make sure to round the last 2 method's numbers as without   #
15# rounding you can get numbers like 299.99999999999994.       #
16# (You can round with the round(integer) function)			  #
17###############################################################
18