Write a Python program that uses the math module to convert a user input angle from radians to degrees. Return the converted angle.
Example 1:
Input: 1
Output: 57.29577951308232
Example 2:
Input: 3.141592653589793
Output: 180.0
The math module contains a function degrees() that converts an angle from radians to degrees.
import math
# Define the function
def convert_to_degrees(radians):
return math.degrees(radians)
# Test the function
print(convert_to_degrees(1)) # Output: 57.29577951308232
print(convert_to_degrees(math.pi)) # Output: 180.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.