# boilerplate-polygon-area-calculator

class Rectangle:
def init(self, width, height):
self.width = width
self.height = height

``````# Setter function (width)
def set_width(self, width):
self.width = width

# Setter function (height)
def set_height(self, height):
self.height = height

#return the areaof the shape
def get_area(self):
return self.width * self.height

#Get  the perimeterof the shape
def get_perimeter(self):
return 2 * self.width + 2 * self.height

#Get diagonal
def get_diagonal(self):
return ((self.width ** 2 + self.height ** 2)**.5)

#Display a picture
def get_picture(self):
if self.height > 50 or self.width > 50:
return "Too big for picture."
for i in range(int(self.height)):
x = (self.width) * ("*")
y = print(x)
return y

#How many times to fir into get_picture
def get_amount_inside(self, obj):
return (self.width // obj.width) * (self.height // obj.height)

def __str__(self) -> str:
return ("Rectangle(width={}, height={})".format(self.width, self.height))
``````

class Square(Rectangle):
def init(self, side):
self.height = side
self.width = side

``````# Setter Function (side)
def set_side(self, side):
self.height = side
self.width = side

# Setter function (width)
def set_width(self, side):
self.width = side

# Setter function (height)

def set_height(self, side):
self.height = side

#String output for the square
def __str__(self):
return "Square(side={})".format(self.width)
``````

I’m having trouble printing the lines (*******)

any help with this

If this is what you intend to do:

``````a = Rectangle(10, 5)
a.get_picture()
``````

Output:

``````**********
**********
**********
**********
**********
``````

The problem may lie in the for loop of the function get_picture:

``````for i in range(int(self.height)):
x = (self.width) * ("*")
y = print(x)
return y
``````

Though you may intend the loop to print 5 lines of “**********”，but once the programe executes “return y”, it returns from the function and not execute the rest of the loop. If you just change the indentation of “return y”, you may get what you want:

``````for i in range(int(self.height)):
x = (self.width) * ("*")
y = print(x)
return y
``````

Alternatively, you may just use print statement without return statement:

``````for i in range(int(self.height)):
x = (self.width) * ("*")
print(x)
``````

yer hadn’t seen that, Thanks @SzeYeung1