Polygon Area Exercise Question

Hi guys, I’m having a problem with a specific part of the exercise, the “get_amount_inside” part. I just don’t understand how that function suppose to works. Should I create an “if/else” for every geometrical figure possible (triangle, square, etc) that may come as an input? Or is it something else? To be honest, I have no clue on what to do with that function. Any help or tip please? Thank you.

Please provide a link to the challenge - I haven’t memorized all the tasks in the Python courses ^^°

Though the task should contain all information needed to solve it. But without a link, it’s hard to say.

Oh I see, my bad xd! I’m sorry

Here’s the link from freeCodeCamp:

As I thought, read the Readme file again: The function will be given a square or rectangle object - nothing else :wink:

Allright, but how do the equation would work in the code? Maybe I’m missing an obvious mathematical formula here, but I don’t know what do once I get the shape. Should I assume that the number of times a square shape enters a rectangle is always half the size of the biggest side of the rectangle? Does it works the same with a rectangle shape or should I use if/else ?

It works regardless of shape.
Here is a hint: a 2x2 square only fits one time into a 3x3 square.

First think about why and then think about how to calculate that :wink:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.