Added a degrees-to-radians snippet.
This commit is contained in:
20
snippets/degrees_to_rads.md
Normal file
20
snippets/degrees_to_rads.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
title: degrees_to_rads
|
||||
tags: math,beginner
|
||||
---
|
||||
|
||||
Converts an angle from degrees to radians.
|
||||
|
||||
Use `math.pi` and the degrees to radians formula to convert the angle from degrees to radians.
|
||||
|
||||
```py
|
||||
import math
|
||||
|
||||
def degrees_to_rads(deg):
|
||||
return (deg * math.pi)/180.0
|
||||
```
|
||||
|
||||
```py
|
||||
import math
|
||||
degrees_to_rads(180) # 3.141592653589793
|
||||
```
|
||||
Reference in New Issue
Block a user