import math angle_in_degrees = 45 angle_in_radians = math.radians(angle_in_degrees) sin_of_angle = math.sin(angle_in_radians) cos_of_angle = math.cos(angle_in_radians)
Here is what the above code is Doing:
1. We’re creating a variable called angle_in_degrees and assigning it the value 45.
2. We’re creating a variable called angle_in_radians and assigning it the value of angle_in_degrees converted to radians.
3. We’re creating a variable called sin_of_angle and assigning it the value of the sine of angle_in_radians.
4. We’re creating a variable called cos_of_angle and assigning it the value of the cosine of angle_in_radians.