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.degrees()
This method is used to set angle measurement units to degrees. By default the angle measurement unit is “degrees”.
Syntax: turtle.degrees(fullcircle=360.0)
Parameter:
fullcircle(optional): a number. Set angle measurement units, i.e. set number of ‘degrees’ for a full circle. Default value is 360 degrees.
Below is the implementation of the above method with an example :
Python3
# importing package import turtle # set turtle speed turtle.speed( 1 ) # forward turtle by 100 turtle.forward( 100 ) # turn the turtle (degrees) turtle.left( 90 ) # print heading print (turtle.heading()) # move forward by 100 turtle.forward( 100 ) # set to radians turtle.radians() # turn to left by 90 (radians) turtle.left( 1.57079633 ) # print heading print (turtle.heading()) # move forward by 100 turtle.forward( 100 ) # set to radians turtle.degrees() # turn to left by 90 (degrees) turtle.left( 90 ) # print heading print (turtle.heading()) |
Output :