From d5c6d2d425185a1e59abad4027eefa2e6597a279 Mon Sep 17 00:00:00 2001 From: Nischay Hegde Date: Tue, 15 Oct 2019 17:01:11 +0530 Subject: [PATCH 1/2] Added a degrees-to-radians snippet. --- snippets/degrees_to_rads.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 snippets/degrees_to_rads.md diff --git a/snippets/degrees_to_rads.md b/snippets/degrees_to_rads.md new file mode 100644 index 000000000..377a1c51a --- /dev/null +++ b/snippets/degrees_to_rads.md @@ -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 +``` From c7f3a0f98201bc5e206c4a852ca6c4956dd1fa42 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 15 Oct 2019 15:16:48 +0300 Subject: [PATCH 2/2] Update degrees_to_rads.md --- snippets/degrees_to_rads.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets/degrees_to_rads.md b/snippets/degrees_to_rads.md index 377a1c51a..8c8b3501e 100644 --- a/snippets/degrees_to_rads.md +++ b/snippets/degrees_to_rads.md @@ -11,10 +11,9 @@ Use `math.pi` and the degrees to radians formula to convert the angle from degre import math def degrees_to_rads(deg): - return (deg * math.pi)/180.0 + return (deg * math.pi) / 180.0 ``` ```py -import math degrees_to_rads(180) # 3.141592653589793 ```