Skip to content

Commit 4508423

Browse files
havishs9pre-commit-ci[bot]ChrisO345
authored
Arc Length Algorithm (TheAlgorithms#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 <[email protected]>
1 parent cbdbe07 commit 4508423

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

maths/arc_length.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from math import pi
2+
3+
4+
def arc_length(angle: int, radius: int) -> float:
5+
"""
6+
>>> arc_length(45, 5)
7+
3.9269908169872414
8+
>>> arc_length(120, 15)
9+
31.415926535897928
10+
"""
11+
return 2 * pi * radius * (angle / 360)
12+
13+
14+
if __name__ == "__main__":
15+
print(arc_length(90, 10))

0 commit comments

Comments
 (0)