# degrees() and radians() in Python

PythonServer Side ProgrammingProgramming

#### Beyond Basic Programming - Intermediate Python

Most Popular

36 Lectures 3 hours

#### Practical Machine Learning using Python

Best Seller

91 Lectures 23.5 hours

#### Practical Data Science using Python

22 Lectures 6 hours

The measurements of angles in mathematics are done using these two units of measurement called degree and radian. They are frequently used in math calculations involving angles and need conversion from one value to another. In python we can achieve these conversions using python functions.

## degrees() Function

This function takes radian value as parameter and return the equivalent value in degrees. The return is a float value.

## Example

Live Demo

import math
# Printing degree equivalent of radians.
print("1 Radians in Degrees : ",math.degrees(1))
print("20 Radians in Degrees : ",math.degrees(20))
print("180 Radians in Degrees : ",math.degrees(180))

## Output

Running the above code gives us the following result −

1 Radians in Degrees : 57.29577951308232
20 Radians in Degrees : 1145.9155902616465
180 Radians in Degrees : 10313.240312354817

This function takes degree value as parameter and return the equivalent value in radians. The return is a float value.

## Example

Live Demo

import math
# Printing radian equivalent of degrees.
print("180 degrees in radian : ",math.radians(180))

## Output

Running the above code gives us the following result −

1 degrees in radian : 0.017453292519943295
60 degrees in radian : 1.0471975511965976
180 degrees in radian : 3.141592653589793

## Degrees and Radians() using numpy

numpy package also has inbuilt functions which can directlyconver degrees to radian and vice versa. These functions are names deg2rad and rad2deg.

## Example

Live Demo

import numpy as np
# Printing radian equivalent of degrees.
print("1 radian to degree : ",np.rad2deg(1))
1 degrees to radian : 0.017453292519943295
1 radian to degree : 57.29577951308232