Sep-12-2020, 10:07 PM
Hey Guys,
I have a question as mentioned in the title. can you use one method's result for another method in the same Class?. I wish to use the result of the area method in the get_amount_inside method. Is there a way to do this? or put the equation for area L*W.
Thanks for your Help!
I have a question as mentioned in the title. can you use one method's result for another method in the same Class?. I wish to use the result of the area method in the get_amount_inside method. Is there a way to do this? or put the equation for area L*W.
Thanks for your Help!
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def get_area(self): area = self.width * self.height return area def get_amount_inside(self, shape): self.shape = shape if self.shape == "sq": num_times = self.area/(self.width * self.width) return num_times