The math.cos()
function returns the cosine of a value given in radians.
math.cos(x)
Where x is t
he angle(in radians) whose cosine we want.
The function returns the cosine of the given number.
import math
angle_in_deg = 20
angle_in_rads = math.radians(angle_in_deg)
print(math.cos(angle_in_rads))
The math.radians() function takes takes an angle in degrees and returns its value in radians.
import math
print(math.cos(math.radians(30)))
print(math.cos(math.radians(45)))
print(math.cos(math.radians(50)))
print(math.cos(math.radians(72)))
The range of values for the cosine of a number lies between -1 and 1.