Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python3 degrees() Function

Python3 degrees() Function

Python3 Numbers Python3 Numbers


Description

degrees() Converts radians to degrees.


Syntax

The syntax of the degrees() method is as follows:


import math

math.degrees(x)

**Note:** degrees() cannot be accessed directly; you need to import the math module and call the method through the static math object.


Parameters


Return Value

Returns a value in degrees.


Example

The following shows examples of using the degrees() method:


#!/usr/bin/python3
import math

print ("degrees(3) : ",  math.degrees(3))
print ("degrees(-3) : ",  math.degrees(-3))
print ("degrees(0) : ",  math.degrees(0))
print ("degrees(math.pi) : ",  math.degrees(math.pi))
print ("degrees(math.pi/2) : ",  math.degrees(math.pi/2))
print ("degrees(math.pi/4) : ",  math.degrees(math.pi/4))

Running the example above produces:


degrees(3) :  171.88733853924697
degrees(-3) :  -171.88733853924697
degrees(0) :  0.0
degrees(math.pi) :  180.0
degrees(math.pi/2) :  90.0
degrees(math.pi/4) :  45.0

Python3 Numbers Python3 Numbers