Question: Using Python, Create a class called Polygon in a file called polygon.py. The constructor should take a parameter that sets a private variable for the

Using Python,

Create a class called Polygon in a file called polygon.py. The constructor should take a parameter that sets a private variable for the number of sides the polygon has. Overload the following operators: +, -, <, >, ==, len(), and str(). Use the number of sides to determine the output of the overloaded operators. Let the user enter two values used to create two Polygon objects. Then print out all results of the overloaded operators (using the operator, not calling the dunder method). Create a file called assn13-task1.py that contains a main() function to run your program. It is fine for the program to only run once then end. You DO NOT need to create loop asking use if they want to "Play Again".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!