File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11from math import pi
22
3-
43def arc_length (angle : float , radius : float ) -> float :
54 """
65 Calculate the arc length of a circle.
6+
77 The arc length is the distance along the curved line making up the arc.
88 Formula: arc_length = 2 * pi * radius * (angle / 360)
99 Wikipedia: https://en.wikipedia.org/wiki/Arc_length
10+
1011 Args:
1112 angle: The angle in degrees
1213 radius: The radius of the circle
14+
1315 Returns:
1416 The arc length as a float
17+
1518 >>> arc_length(45, 5)
1619 3.9269908169872414
1720 >>> arc_length(120, 15)
@@ -39,8 +42,6 @@ def arc_length(angle: float, radius: float) -> float:
3942 raise ValueError ("angle and radius must be positive" )
4043 return 2 * pi * radius * (angle / 360 )
4144
42-
4345if __name__ == "__main__" :
4446 import doctest
45-
4647 doctest .testmod ()
You can’t perform that action at this time.
0 commit comments