Write a Python program that uses the math module to find the cosine of a user input angle (in degrees). Return the cosine.
Example 1:
Input: 60
Output: 0.5
Example 2:
Input: 90
Output: 0.0
Use the cos() function from the math module. Make sure to convert the angle from degrees to radians.
import math
def cosine(angle):
radians = math.radians(angle)
return math.cos(radians)
# Test the function
print(cosine(60)) # Output: 0.5
print(cosine(90)) # Output: 0.0
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.