Build a Polygon Area Calculator Project - Build a Polygon Area Calculator Project

Tell us what’s happening:

Plz kindly help me to solve this issue, come to stuck.

IMG_0013

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 (iPad; CPU OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/127.0.6533.56 Mobile/15E148 Safari/604.1

Challenge Information:

Build a Polygon Area Calculator Project - Build a Polygon Area Calculator Project

If you have a 2x2 square and change only the height to 4, is it still a square?

Also, I believe Class always refers to an instance as self