Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise: Get Circumference Method Description In this exercise, you will add to your circle class a method to calculate the circumference of a circle instance.
Exercise: Get Circumference Method Description In this exercise, you will add to your circle class a method to calculate the circumference of a circle instance. If you don't know the formula, find it. Use an approximation for pi that has at least 7 digits. Class Name Circle Method getcircumference () Parameters self: the circle object to use Action Calculates the circumference of the circle and returns it. Return Value A number, the circumference of the circle. Examples c = Circle (0.5) c.getcircumference () -> 3.1415926535... Hints Remember, you're adding to the code from the previous step. math.pi from the math module has a reasonable approximation of Pi. import math class Circle: def __init__(self, r): self.radius = r. def getRadius(self): return self.radius def getArea(self): area = self.radius*self.radius*math.pi return area = def setRadius(self, radius): if radius >= 0: self.radius = radius return True else: return false
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started