Tell us what’s happening:
Can someone please help me understand what is going wrong with my code? I can’t pass test 16 and am unsure of how to proceed with completing the test.
Your code so far
class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def set_width(self,width):
self.width = width
def set_height(self, height):
self.height = height
def get_area(self):
return self.width*self.height
def get_perimeter(self):
return 2*(self.width+self.height)
def get_diagonal(self):
return((self.width**2+self.height**2)**0.5)
def get_picture(self):
if self.width>50 or self.height>50:
return "Too big for picture."
else:
picture = ''
for i in range(0,self.height):
picture += "*"*self.width+'\n'
return picture
def __str__(self):
return f'Rectangle(width={self.width}, height={self.height})'
def get_amount_inside(self, shape):
times = 0
if (shape.width < self.width) and (shape.height < self.height):
times = (self.height // shape.height)*(self.width // shape.width)
return times
else:
times = 0
return times
class Square(Rectangle):
def __init__(self, side):
Rectangle.width = side
Rectangle.height = side
def set_side(self,side):
Rectangle.width = side
Rectangle.height = side
def set_width(self, side):
Rectangle.width = side
def set_height(self, side):
Rectangle.height = side
def __str__(self):
return f'Square(side={Rectangle.width})'
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Build a Polygon Area Calculator - Build a Polygon Area Calculator