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

Tell us what’s happening:

i’m stuck where do i look if i want to see what to do next, im just confused on what to do

Your code so far

class Rectangle:
    def set_width():
        pass
    def set_height():
        pass
    def get_area():
        return (width ** 2 + height ** 2) ** .5
    def get_perimeter():
        return 2 * width + 2 * height
    def get_diagonal():
        return (width ** 2 + height ** 2) ** .5
    def get_picture():
        return ""
    def get_amount_inside():
        pass


class Square(Rectangle):
    def __init__():
        pass

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Challenge Information:

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

the instructions and the hints tell you what to do next.

For example, why your Rectangle class is so empty? you are missings lots of required features there

1 Like

As mentioned, the instructions and the tests on the left is just a big list of things to do.

Take it step by step. Focus on implementing one thing at a time. Look at the first one:

When a Rectangle object is created, it should be initialized with width and height attributes.

Your class isn’t doing this. If you don’t remember how to initialize a class in Python, search for a guide:
https://www.w3schools.com/python/gloss_python_class_init.asp

Implement this in your class.

Then implement the next item in the list of instructions. Repeat

1 Like

how could i use the hints to guide me tho, because it doesn’t seem like they are in order

You don’t really have to follow the instructions in any particular order, you just need to complete all the requirements.

Easiest to start at the top of the instructions and work your way down until all the tests pass.

Just focus on the first one first. Or any one you want, you’re just procrastinating now.

1 Like

also just to be clear i shouldn’t be asking for help

If there’s something you forget how to do: Internet search.

If there’s something specific to the project that you’re unsure about, try searching the forum.

If you can’t find a solution, sleep on it and see if your brain figures it out while you sleep.

If you’re still really stuck, come to the forum with a specific question about what you’re trying to do and how it’s not working.

okay and last question i won’t pester you any longer but, is this project suppose to be hard, i don’t see many people on the forum opening topics about it recently, i feel like a total dummy.

You’re learning programming on your own, it’s hard and it will often be humbling. Everyone feels like that. Anyone who is flying through this and feels smart isn’t learning anything.

It’s good to feel dumb, that means you’re challenging yourself and you are learning. Learn to love that feeling.

1 Like

i don’t get this whole concept of takes another shape for example

  • get_picture: Returns a string that represents the shape using lines of ‘'. The number of lines should be equal to the height and the number of '’ in each line should be equal to the width. There should be a new line (\n) at the end of each line. If the width or height is larger than 50, this should return the string: 'Too big for picture.'.
  • get_amount_inside: Takes another shape (square or rectangle) as an argument. Returns the number of times the passed in shape could fit inside the shape (with no rotations). For instance, a rectangle with a width of 4 and a height of 8 could fit in two squares with sides of 4.

this step i have no idea what to do other then an if statement self.width is > self.height for the first type, i don’t understand what it means by" a shape" in the first and second step. In the first step i don’t understand the whole return a string idea it mentions at the beginning
my code so far

class Rectangle:
    def __init__(self,width,height):
        self.width = width
        self.height = height
    def set_width():
        pass
    def set_height():
        pass
    def get_area():
       return self.width * self.height
    def get_perimeter():
        return 2 * width + 2 * height
    def get_diagonal():
        return (width ** 2 + height ** 2) ** .5
    def get_picture():
        if self.width > 50 or self.height > 50:
            return 'Too big for picture.'
        s = '*'
        for i in range (1,6):
            print(*s * 5)

    def get_amount_inside():
        pass


class Square(Rectangle):
    def __init__(self,square):
        super().__init__(square,square)

your get_picture is not always returning a string

what string should it return tho if not Too big for picture, i can’t just put too big for picture at the start of method

the rectangle of asterisks, the one described in the text you copied from the project

get_picture : Returns a string that represents the shape using lines of * The number of lines should be equal to the height and the number of * in each line should be equal to the width. There should be a new line (\n ) at the end of each line.

but how do i make this a rectangle? i’ve lloked up print patterns on youtube and i can’t find a match for this.

how does this code make the asterisk repeat five times?

because i’ve got a value s which is equal to * and im multiplying that value by 5

how can you update that to be of a length that is always equal to the rectangle width?

well rectangular width we have no knowledge of, so i don’t see how we can make it equal to unless we do something like self.length = self.width

there is no self.length, you just have your s, and you want to create a row of asterisk so that the number of asterisks is equal to the width of the rectangle. You need to do a small change to this that you wrote earlier

but what is the width of the rectangle it doesn’t say anywhere, my mind is so overwhelmed cuz i feel like a dummy but i don’t see a width of rectangle