We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c52813d commit af54e71Copy full SHA for af54e71
maths/arc_length.py
@@ -28,3 +28,18 @@ def arc_length(angle: float, radius: float) -> float:
28
>>> arc_length(-90, 10)
29
Traceback (most recent call last):
30
...
31
+ ValueError: angle and radius must be positive
32
+ >>> arc_length(90, -10)
33
+ Traceback (most recent call last):
34
+ ...
35
36
+ """
37
+ if angle < 0 or radius < 0:
38
+ raise ValueError("angle and radius must be positive")
39
+ return 2 * pi * radius * (angle / 360)
40
+
41
42
+if __name__ == "__main__":
43
+ import doctest
44
45
+ doctest.testmod()
0 commit comments