There is one error ii am not able to figure out

Tell us what’s happening:

Your code so far

class Rectangle():
    
  def __init__(self, width, height):
    self.width = width
    self.height = height
  
  def set_width(self, new_width):
    self.width = new_width
  def set_height(self, new_height):
    self.height = new_height
  
  def get_area(self): 
    return (self.width * self.height)

  def get_perimeter(self): 
    return (2 * self.width + 2 * self.height)

  def get_diagonal(self): 
    return ((self.width ** 2 + self.height ** 2) ** .5)
  
  def __str__(self):
    return(("Rectangle(width={0}, height={1})").format(self.width, self.height))


  def get_picture(self):
      if self.width > 50 or self.height > 50:
        return ("Too big for picture.")
      else:
         return ((("*" * self.width)+ "\n" )* self.height)

  def get_amount_inside(self,shape):
    shape_area = shape.get_area()
    home_area = self.get_area()
    count = 0
    while home_area > shape_area:
      home_area = home_area - shape_area
      count += 1
    return count
   

class Square(Rectangle):

  def __init__(self, side):
    Rectangle.width = side
    Rectangle.height = side
  
  def set_side(self, newside):
    Rectangle.width = newside
    Rectangle.height = newside

  def __str__(self):
    return (("Square(side={})".format(Rectangle.width)))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36.

Challenge: Probability Calculator

Link to the challenge:

Hi, what, error are you seeing?


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Hey @nayankoshiya ,
I guess this method is responsible for the error that you’re facing. I think you need to set the value of newside with the methods set_width and set_height as below:

  def set_side(self, newside):
    Rectangle.set_width(self, newside)
    Rectangle.set_height(self, newside)

This should fix the problem. Check it.