๐Ÿ“ฆ TheAlgorithms / Python

๐Ÿ“„ arc_length.py ยท 18 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18from math import pi


def arc_length(angle: int, radius: int) -> float:
    """
    >>> arc_length(45, 5)
    3.9269908169872414
    >>> arc_length(120, 15)
    31.415926535897928
    >>> arc_length(90, 10)
    15.707963267948966
    """
    return 2 * pi * radius * (angle / 360)


if __name__ == "__main__":
    print(arc_length(90, 10))