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

Python3 radians() Function

Python3 radians() Function

Python3 Numbers Python3 Numbers


Description

radians() The method converts degrees to radians.

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

Syntax

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


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/python3

import

math

print

(

"radians(90) : "

,

 

math

.

radians

(

90

)

)

   

1 radian is about 57.3°

print

(

"radians(45) : "

,

 

math

.

radians

(

45

)

)

print

(

"radians(30) : "

,

 

math

.

radians

(

30

)

)

print

(

"radians(180) : "

,

 

math

.

radians

(

180

)

)

 

180 degrees is π radians

print

(

"180 / pi : "

,

end

=

""

)

print

(

math

.

radians

(

180

/

math

.

pi

)

)

Running the example above produces:


radians(90) :  1.5707963267948966
radians(45) :  0.7853981633974483
radians(30) :  0.5235987755982988
radians(180) :  3.141592653589793
180 / pi : 1.0

Python3 Numbers Python3 Numbers