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

Python radians() function

Python radians() function

Python Numbers Python Numbers


Description

radians() The method converts degrees to radians.


Syntax

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

The relationship between degrees and radians is: 2π radians = 360°. Thus 1°≈0.0174533 radians and 1 radian≈57.29578°.



import math



math.radians(x)

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


Parameters


Return Value

Returns the radian value of an angle.


Example

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

Example

#!/usr/bin/python

import

math

print

"radians(90) : "

,

 

math

.

radians

(

90

)

print

"radians(45) : "

,

 

math

.

radians

(

45

)

print

"radians(30) : "

,

 

math

.

radians

(

30

)

Running the example above produces:



radians(90) :  1.57079632679

radians(45) :  0.785398163397

radians(30) :  0.523598775598

Python Numbers Python Numbers