# How to convert Python degrees to radians

In this python tutorial, you will learn about the Python degrees to radians. Let us see how to convert degrees to radians in Python.

Also, we will check:

• What is a python math module?
• Python degrees to radians using numpy
• Python radians to degrees using numpy
• Write a python program to convert radian to degree
• How to print the degree symbol in python
• How to convert a number to radians in python
• Convert angles from degrees to radians in python

## What is a python math module?

Python has a built-in module that can be used for the mathematical task on numbers. The math module contains functions for calculating the various trigonometric ratios for a given angle.

The math module presents two angles conversion function which is degrees() and radians(). The math module has a set of methods.

In python, math.radians() method is used to convert a degree value to radians. So, we will first import math module.

Example:

``````import math

After writing the above code (python degrees to radians), Ones you will print “math.radians(120)” then the output will appear as a “ 2.0943951023931953 “.

You can refer to the below screenshot for python degrees to radians.

This is how we can convert degrees to radian in Python.

Here, we will see how we can convert radians to degrees in python.

To convert radians to degrees, we will use math.degrees() for convert radians to degrees.

Example:

``````import math

After writing the above code (python radians to degrees), Ones you will print “math.degrees()” then the output will appear as a “ 90.0 “. Here, math.degrees(radians) convert the radians value to degrees.

You can refer to the below screenshot for python radians to degrees.

The above code, we can use to convert radians to degrees in Python.

## Python degrees to radians using numpy

Let’s see how to convert degrees to radians using numpy.

To convert degrees to radians, we have to import numpy package first. It has an inbuilt function name deg2rad() which can directly convert degrees to radians.

Example:

``````import numpy as np

After writing the above code (python degrees to radians using numpy), Ones you will print ” np.deg2rad(2)” then the output will appear as “ degrees to radian: 0.03490658503988659 “. Here, np.deg2rad(2) will convert degrees to radians.

You can refer to the below screenshot for Python degrees to radians using numpy.

## Python radians to degrees using numpy

To convert radians to degrees in Python, we have to import numpy package first. It has an inbuilt function name rad2deg() which can directly convert radians to degrees.

Example:

``````import numpy as np

After writing the above code (python radians to degrees using numpy), Ones you will print ” np.rad2deg(2)” then the output will appear as “ radian to a degree: 114.59155902616465 “. Here, np.rad2deg(2) will convert radians to degrees.

You can refer to the below screenshot for python radians to degrees using numpy.

## Write a python program to convert radian to degree

In this program, we have taken the pi value as 3.14159 and the radian as 10 while printing it will convert the radian to a degree.

``````def convert(radian):
pi = 3.14159
return degree

After writing the above code (write a python program to convert radian to a degree), Ones you will print “convert(radian)” then the output will appear as a “degree = 572.9582790879778“. Here, degree = radian * (180/pi) and radian=10. So in this way, we can convert radian to a degree.

You can refer to the below screenshot for python program to convert radian to degree.

## How to print the degree symbol in python

For printing the degree symbol in python, we will use u”\N{Degree Sign}” and we have used unicode to print the degree symbol.

Example:

``````degree_sign = u"\N{Degree Sign}"
print(degree_sign)``````

After writing the above code (how to print the degree symbol in python), Once you will print “(degree_sign)” then the output will appear as a “ ° “. Here, u”\N{Degree Sign}” is used to print the degree symbol.

You can refer to the below screenshot how to print the degree symbol in python.

## How to convert a number to radians in python

Firstly, we need to import math module. To convert a number to radians in Python, we will use radians(number) to convert the number to radians and we need to call this function using a math object.

Example:

``````import math

After writing the above code (how to convert a number to radians in python), Once you will print “math.radians(5)” then the output will appear as a “ radians(5): 0.08726646259971647 “. Here, math.radians(5) is used to convert a number to radians in python.

You can refer to the below screenshot how to convert a number to radians in python.

## Convert angles from degrees to radians in python

Now, we will see how to convert angles from degrees to radians in python.

We will first import numpy module and then we will print np.radians(120) and it will get converted to radians.

Example:

``````import numpy as np

You can refer to the below screenshot Convert angles from degrees to radians in python.

You may like the following Python tutorials:

In this Python tutorial we learned about Python degrees to radians. Also, we covered these below topics:

• What is a python math module?
• How to convert degrees to radians in Python
• How to convert radians to degrees in Python
• Python degrees to radians using numpy
• Python radians to degrees using numpy
• Write a python program to convert radian to degree
• How to print the degree symbol in python
• How to convert a number to radians in python
• Convert angles from degrees to radians in python