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.
2 parents de8d2d7 + d2346f8 commit 3170192Copy full SHA for 3170192
1 file changed
geometry/geometry.py
@@ -103,9 +103,11 @@ def area(self) -> float:
103
def perimeter(self) -> float:
104
"""
105
>>> Ellipse(5, 10).perimeter
106
- 47.12388980384689
+ 48.44222344723793
107
108
- return math.pi * (self.major_radius + self.minor_radius)
+ a, b = self.major_radius, self.minor_radius
109
+ #uses ramanujans approximation
110
+ return math.pi * (3*(a + b) - ((3*a + b)*(a + 3*b))**0.5)
111
112
113
class Circle(Ellipse):
0 commit comments