Python Math – Convert radians to degrees

In this post we will be creating a Python script that will convert a given number of radians to degrees. The script will take a number via input and covert it to degrees before printing to output. To achieve this we will be using the math module, which provides access to the mathematical functions defined by the C standard.

See the snippet of Python code below which uses the ‘degrees()’ function, the function will convert the given number of radians to degrees and then return this to output.

import math

while True:
    Number=int(input("Please enter radians: "))

An example of the code being run can be seen below.

Please enter radians: 1
57.29577951308232 degrees
Please enter radians: 2
114.59155902616465 degrees
Please enter radians: 2.7
154.6986046853223 degrees
Please enter radians: 5
286.4788975654116 degrees

Take a look at some of our other content around the Python programming language by clicking here.

Leave a Reply