# Angular conversion functions in Python

Python Angular conversion functions: Here, we are going to learn about the Angular conversion functions of math module with examples in Python?
Submitted by IncludeHelp, on April 25, 2019

## Python Angular conversion functions/methods

In python programming language, there are some of the built-in functions which are defined in math module – they can be used for angular conversion i.e. to convert angle values, there are two angular conversion functions:

1. math.degrees()
It is used to convert angle value from radians to degrees.
It is used to convert angle value from degrees to radians.

Syntax of math.degrees() and math.radians() functions:

```    math.degrees(x)
```

Example:

```    Input:
x = 10.25 # value in radians

# converting & printing in degrees
x = math.degrees(x)
print(x)

# again, converting & printing in radians
print(x)

Output:
587.2817400090938
10.25
```

### Python code to demonstrate example of angular conversion functions

```# Python code to demonstrate example of

# importing math module
import math

x = 10.25

# converting to degrees
x = math.degrees(x)
print("x in degrees: ", x)

# now again converting to radians
```

Output

```x in radians:  10.25
x in degrees:  587.2817400090938
```

Note: If we provide anything except a number type value to these functions, they returns a TypeError.

```# Python code to demonstrate example of
# math.degrees() with exception

# importing math module
import math

# angle x in string (invalid)
x = "10.25"

# converting to degrees
x = math.degrees(x)
print("x in degrees: ", x)
```

Output

```Traceback (most recent call last):
File "/home/main.py", line 12, in <module>
x = math.degrees(x)
TypeError: a float is required
```

Preparation