I have a python programming question Create a package called geometry. Inside that package create two modules: rectangle.py and triangle.py. Also create an empty file with name __init__.py in the geometry package.Inside rectangle.py define three functions:1. rectArea(): this function takes two parameters length and width of a rectangle, calculates and returns the area.2. rectCircumference(): this function takes two parameters length and width of a rectangle, calculates and returns the circumference.3. isSquare(): this function takes two parameters length and width of a rectangle and returns true if they are equal otherwise returns false.Inside triangle.py define two functions:1. triArea(): this function takes two parameters base and height of a triangle, calculates and returns the area.2. triCircumference(): this function takes three parameters, three sides of a triangle and returns the circumference.Create main.py in the same directory as the geometry package. Import your modules. Prompt the user to select an operation among 5 different functions. Once the user enters the proper selection, ask the user to input the necessary arguments. Call the proper functions from your modules and print the result. Continue until the user enters a sentinel value such as -1.Sample output:Enter selection,1 for Area of rectangle2 for Circumference of rectangle3 for Check if square4 for Area of triangle5 for Circumference of Triangle-1 to exit:1Enter length:4Enter width:6Area= 24Enter selection,1 for Area of rectangle2 for Circumference of rectangle3 for Check if square4 for Area of triangle5 for Circumference of Triangle-1 to exit:2Enter length:2Enter width:3Circumference= 10Enter selection,1 for Area of rectangle2 for Circumference of rectangle3 for Check if square4 for Area of triangle5 for Circumference of Triangle-1 to exit:3Enter length:4Enter width:4It is a squareEnter selection,1 for Area of rectangle2 for Circumference of rectangle3 for Check if square4 for Area of triangle5 for Circumference of Triangle-1 to exit:4Enter base:7Enter height:8Area= 28.0Enter selection,1 for Area of rectangle2 for Circumference of rectangle3 for Check if square4 for Area of triangle5 for Circumference of Triangle-1 to exit:5Enter side1:2Enter side2:5Enter side3:7Circumference= 14Enter selection,1 for Area of rectangle2 for Circumference of rectangle3 for Check if square4 for Area of triangle5 for Circumference of Triangle-1 to exit:-1Program ended
I have a python
Create a package called geometry. Inside that package create two modules: rectangle.py and triangle.py. Also create an empty file with name __init__.py in the geometry package.
Inside rectangle.py define three functions:
1. rectArea(): this function takes two parameters length and width of a rectangle, calculates and returns the area.
2. rectCircumference(): this function takes two parameters length and width of a rectangle, calculates and returns the circumference.
3. isSquare(): this function takes two parameters length and width of a rectangle and returns true if they are equal otherwise returns false.
Inside triangle.py define two functions:
1. triArea(): this function takes two parameters base and height of a triangle, calculates and returns the area.
2. triCircumference(): this function takes three parameters, three sides of a triangle and returns the circumference.
Create main.py in the same directory as the geometry package. Import your modules. Prompt the user to select an operation among 5 different functions. Once the user enters the proper selection, ask the user to input the necessary arguments. Call the proper functions from your modules and print the result. Continue until the user enters a sentinel value such as -1.
Sample output:
Enter selection,
1 for Area of rectangle
2 for Circumference of rectangle
3 for Check if square
4 for Area of triangle
5 for Circumference of Triangle
-1 to exit:
1
Enter length:4
Enter width:6
Area= 24
Enter selection,
1 for Area of rectangle
2 for Circumference of rectangle
3 for Check if square
4 for Area of triangle
5 for Circumference of Triangle
-1 to exit:
2
Enter length:2
Enter width:3
Circumference= 10
Enter selection,
1 for Area of rectangle
2 for Circumference of rectangle
3 for Check if square
4 for Area of triangle
5 for Circumference of Triangle
-1 to exit:
3
Enter length:4
Enter width:4
It is a square
Enter selection,
1 for Area of rectangle
2 for Circumference of rectangle
3 for Check if square
4 for Area of triangle
5 for Circumference of Triangle
-1 to exit:
4
Enter base:7
Enter height:8
Area= 28.0
Enter selection,
1 for Area of rectangle
2 for Circumference of rectangle
3 for Check if square
4 for Area of triangle
5 for Circumference of Triangle
-1 to exit:
5
Enter side1:2
Enter side2:5
Enter side3:7
Circumference= 14
Enter selection,
1 for Area of rectangle
2 for Circumference of rectangle
3 for Check if square
4 for Area of triangle
5 for Circumference of Triangle
-1 to exit:
-1
Program ended
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images