Python math.degrees() Method

Python math.degrees() method is “used to convert the radian value to degrees.”

Syntax

math.degrees(var) 

Parameters

var: It takes values of numeric datatype and throws a type error if an argument of any other data type is passed.

Return Value

It returns the degree value of the number in the float datatype.

Example 1: How to Use math.degrees() Method

import math

a1 = 0.36
b1 = 1
c1 = -1
d1 = -0.36

print("Value for parameter ", a1, " is ", math.degrees(a1))
print("Value for parameter ", b1, " is ", math.degrees(b1))
print("Value for parameter ", c1, " is ", math.degrees(c1))
print("Value for parameter ", d1, " is ", math.degrees(d1))

Output

Value for parameter 0.36 is 20.626480624709636
Value for parameter 1 is 57.29577951308232
Value for parameter -1 is -57.29577951308232
Value for parameter -0.36 is -20.626480624709636

Example 2: TypeError

import math

a = 'I am a web developer!'
print(math.degrees(a))

Output

TypeError: must be real number, not str 

That’s it.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.