From b2fd0b2575bc73e5d3f1006ec23ce011d9c9fdd7 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Tue, 20 Aug 2019 15:58:57 +0300 Subject: [PATCH] Add rads_to_degrees snippet --- snippets/rads_to_degrees.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 snippets/rads_to_degrees.md diff --git a/snippets/rads_to_degrees.md b/snippets/rads_to_degrees.md new file mode 100644 index 000000000..501ef1e74 --- /dev/null +++ b/snippets/rads_to_degrees.md @@ -0,0 +1,20 @@ +--- +title: rads_to_degrees +tags: math,beginner +--- + +Converts an angle from radians to degrees. + +Use `math.pi` and the radian to degree formula to convert the angle from radians to degrees. + +```py +import math + +def rads_to_degrees(rad): + return (rad * 180.0) / math.pi +``` + +```py +import math +rads_to_degrees(math.pi / 2) # 90.0 +```