From 450842321d30ab072a84aee15dfdbf199f9914dc Mon Sep 17 00:00:00 2001 From: Havish <100441982+havishs9@users.noreply.github.com> Date: Tue, 25 Oct 2022 12:47:52 -0700 Subject: [PATCH] Arc Length Algorithm (#7610) * Create decimal_conversions.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Create arc_length.py * Delete decimal_conversions.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed redundant statement, fixed line overflow * Update arc_length.py Changed rad to radius as not to get confused with radians * Update arc_length.py * Update arc_length.py Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Chris O <46587501+ChrisO345@users.noreply.github.com> --- maths/arc_length.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 maths/arc_length.py diff --git a/maths/arc_length.py b/maths/arc_length.py new file mode 100644 index 000000000..9e87ca38c --- /dev/null +++ b/maths/arc_length.py @@ -0,0 +1,15 @@ +from math import pi + + +def arc_length(angle: int, radius: int) -> float: + """ + >>> arc_length(45, 5) + 3.9269908169872414 + >>> arc_length(120, 15) + 31.415926535897928 + """ + return 2 * pi * radius * (angle / 360) + + +if __name__ == "__main__": + print(arc_length(90, 10))