Python radians

The Python radians function is used to convert the given angle from Degrees to Radians. In this section, we discuss how to use the Python radians function with an example, and the syntax of it is

math.radians(number);

Number: It can be a number or a valid numerical expression.

  • If the number argument is a positive or negative number, it returns the output.
  • If it is not a number, it returns TypeError.

Python radians Function Example

This math Function converts the given angle from Degrees to Radians. In this example, we use this Python function to convert the degrees of different data types to radians and display the output.

import math

Tup = (10, 20, 80, 40 , 50) # Tuple Declaration
Lis = [80.65, 35.48, 92.65, 50.41 , 17.27] # List Declaration

print('Calculating Radians of Zero = %.2f' %math.radians(0))
print('Calculating Radians of Positive Integer = %.2f' %math.radians(6))
print('Calculating Radians of Negative Integer = %.2f' %math.radians(-12))

print('Calculating Radians of Positive Decimal = %.2f' %math.radians(4.56))
print('Calculating Radians of Negative Decimal = %.2f' %math.radians(-15.78))

print('Calculating Radians of Tuple Item = %.2f' %math.radians(Tup[2]))
print('Calculating Radians of List Item = %.2f' %math.radians(Lis[2]))

print('Calculating Radians of Multiple Numbers = %.2f' %math.radians(10 + 20 - 25))

print('Calculating Radians of PIE = %.4f' %math.radians(math.pi))
print('Calculating Radians of PIE/2 = %.4f' %math.radians(math.pi/2))
print('Calculating Radians of PIE/4 = %.4f' %math.radians(math.pi/4))
print('Calculating Radians of PIE/6 = %.4f' %math.radians(math.pi/6))

print('Calculating Radians of String Value = ', math.radians('3'))
Python RADIANS Function
  1. Within the first three statements, We used the Zero, Positive integer, and negative integer values as arguments.
  2. Next two statements, we used the Python radians Function with both the Positive and negative decimal values as arguments to convert degrees.
  3. Next two Python statements, we used this Math function on Tuple and Lis items. If you observe the above screenshot, it is working perfectly on them.
  4. We tried directly on multiple values.
  5. Next, we used it on Pie values.
  6. In the last statement, We used it on the String value. It returns TypeError as output.