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 radians function in Python with example.

The syntax of the radians Function in Python Programming Language 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, the radians function to return the output.
  • If it is not a number, radians function returns TypeError.

Python radians Function Example

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

# Python RADIANS Function

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 radians Function with 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.
  3. Next two Python statements, we used this Python Math functions Function on Python Tuple and Python Lis items. If you observe the above screenshot, the radians function is working perfectly on them.
  4. We tried radians Function directly on multiple values.
  5. Next, we used the radians Function on Pie values.
  6. In the Last statement, We used the Radians Function on the String value. It return TypeError as output.