Introduction
In mathematics, angles can be measured in degrees or radians. Radians are the standard unit of angular measure, used in many areas of mathematics and physics. In this challenge, you will be asked to write a function that converts an angle from degrees to radians.
Degrees to Radians
Write a function degrees_to_rads(deg) that takes an angle in degrees as an argument and returns the angle in radians. Your function should use the following formula to convert degrees to radians:
radians = (degrees * pi) / 180.0
where pi is a constant value representing the ratio of the circumference of a circle to its diameter (approximately 3.14159).
Your function should return the angle in radians rounded to 4 decimal places.
from math import pi
def degrees_to_rads(deg):
return (deg * pi) / 180.0
degrees_to_rads(180) ## ~3.1416
Summary
In this challenge, you have learned how to convert an angle from degrees to radians using the formula radians = (degrees * pi) / 180.0. You have also written a function that implements this formula and returns the angle in radians rounded to 4 decimal places.