Skip to content
Related Articles

Related Articles

Improve Article
turtle.degrees() function in Python
  • Last Updated : 01 Aug, 2020

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 :

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :