Skip to content

Commit

Permalink
Arc Length Algorithm (TheAlgorithms#7610)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Oct 25, 2022
1 parent cbdbe07 commit 4508423
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions maths/arc_length.py
Original file line number Diff line number Diff line change
@@ -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))

0 comments on commit 4508423

Please sign in to comment.