Can someone help me write this program!

Write a program (must be a .py file) that calculates the perimeter and area of a circle, equilateral triangle, square, and rectangle.

The program should prompt the user the choice of the four shapes: Force the user to enter the right choice!

Then the program should ask for the length of the triangle or square, or the radius of the circle, or the two sides of the rectangle.

For the triangle, you can use this formula: A = sqrt(3)*((a**2)/4)

In order to perform a square root operation and pi, you must import math and use this function: math.sqrt(n), math.pi

The program should output the perimeter and area of the chosen shape.

The program should continue to run till the user wants to quit.

At the beginning of the program, you should describe it and state the inputs and outputs in comments.

The four shapes must be calculated in independent functions: You will have 5 functions, main(), circle(), triangle(), square() and rectangle().

Honor code applies, you must write your own code.

Start working on the program early.

Mod Edit: Source not attributed
SERP links added as hint to learners

We can only help you help yourself. Please keep us abreast of your ideas and code models. There is willing support available, but the instructions state you must write your own code. Submit that for comments as you progress through what the instructor must have decided should be a limited duration (it has a due date).

4 Likes