Tell us what’s happening:
Do we no longer use replit? I have run the tests on the project description page and passed all but two. Unfortunately it doesn’t tell me what is wrong with my solution like replit did and so i don’t know what to change. Help would be appreciated.
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Mobile Safari/537.36
Challenge Information:
Scientific Computing with Python Projects - Polygon Area Calculator
Learn to Code — For Free
ILM
March 18, 2024, 9:32am
2
you need to provide your code to get any help
Hi,
Thanks for your reply. This is my code:
class Rectangle():
def __init__(self, width, height):
self.width = width
self.height = height
def __str__(self):
return f'Rectangle(width={self.width}, height={self.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 + 2 * self.height
def get_diagonal(self):
return (self.width ** 2 + self.height ** 2) ** .5
def get_picture(self):
count = 0
string = '*'
line = string * self.width
result = f''
if self.width > 50:
return 'Too big for picture.'
elif self.height > 50:
return 'Too big for picture.'
else:
pass
while count < self.height:
if count == 0:
result = f'{line}'
else:
result = f'{result}\n{line}'
count += 1
return result
def get_amount_inside(self, shape):
x = self.width // shape.width
y = self.height // shape.height
return (x * y)
class Square(Rectangle):
def __init__(self, side):
self.side = side
self.width = self.side
self.height = self.side
def __str__(self):
return f'Square(side={self.side})'
def set_side(self, side):
self.side = side
self.width = side
self.height = side
def set_height(self, height):
self.set_side(height)
def set_width(self, width):
self.set_side(width)
I think it could be this
There should be a new line (\n
) at the end of each line.
It keeps crashing when I test it, hopefully you have better luck
system
Closed
September 17, 2024, 2:32am
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.