Python math.degrees()

Anonymous contributor's avatar
Anonymous contributor
Published Aug 22, 2024

In Python, the math.degrees() function takes an angle measured in radians and returns its degree equivalent as a floating-point value.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours

Syntax

math.degrees(x)
  • x: A numeric value or expression representing an angle in radians. If it is not a number, the function will raise a TypeError.

Here is an image that illustrates some common degree-radian equivalencies:

"45 degree rotations expressed in radian measure" by Adrignola

Example 1

In the example below, the math.degrees() function returns the degree equivalent of π:

import math
pi = math.pi
print(math.degrees(pi))

The above code gives the following output:

180.0

Example 2

In the following example, the math.degrees() function returns the degree equivalent of 1 radian:

import math
print(math.degrees(1.0))

The above code produces the following output:

57.29577951308232

Codebyte Example

The following codebyte example demonstrates how the math.degrees() function works:

Code
Output

All contributors

Learn Python on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.
    • With Certificate
    • Beginner Friendly.
      24 hours