Angular Conversion Functions
What You'll Learn: In this tutorial, you'll discover various angular conversion functions available in Python's math module. These functions help you convert angles between degrees and radians.
Angular Conversion Functions
math.degrees(x)- Converts angle x from radians to degrees.Example:
pythonimport math radians = math.pi degrees = math.degrees(radians) print(degrees) # Output: 180.0
math.radians(x)- Converts angle x from degrees to radians.Example:
pythonimport math degrees = 180 radians = math.radians(degrees) print(radians) # Output: 3.141592653589793
Try It Yourself: Fun Exercises
- Convert Radians to Degrees:
- Use
math.degrees()to convert various angles from radians to degrees, like π/2, π, and 2π.
- Use
- Convert Degrees to Radians:
- Use
math.radians()to convert various angles from degrees to radians, like 90°, 180°, and 360°.
- Use
Summary:
In this Python tutorial, we explored various angular conversion functions available in the math module. These functions help you convert angles between degrees and radians. Keep experimenting and have fun with Python!