Question
Write a program, in python, that displays the following menu: Menu 1. Calc the Vol of a Sphere 2. Cal the Area of a Triangle
Write a program, in python, that displays the following menu:
Menu
1. Calc the Vol of a Sphere
2. Cal the Area of a Triangle
3. Show Odd numbers and their squares between 1-25
4. Exit
Enter your selection (1-4):
Requirements:
- Loop through the menu options until option 4 is selected
- Give an error message if 1, 2, 3, or 4 are not selected
- Creates a function for the 'Menu'
- Selection # 1: Calculates the volume of a sphere.
- Create a function that asks for the radius of a circle and use the return statement
- Do not accept a negative number for the radius
- Create a function that calculates the area using the radius as an parameter in the
- Use the following formula: Volume =4/3* *r*r*r
- Use Math.PI, and import the math file
- Create a function that displays the radius and area as shown below:
- Must line up decimals with 2 decimal places
Ex.
Radius: 100.00
Volume: 4188.79
Selection # 2: Calculates the area of a triangle
- Create a function that asks for the length of the triangles base and its height.
- Use the return statement
- Create a function to calculate the area using the length and width as the parameters
- Use the following formula: area = base * height * .5
- 2 decimal places, comma and decimal places are lined up for the output
Ex.
Height: 500.00
Base 400.00
Triangle Area: 1,000.00
Selection # 3: Print the odds and their square roots between 1 and 25
- Create a function using a for loop to display the data as shown:
- Use this guide for the output: print("{0:<10d} {1:>7.2f}".format(??, ????))
Selection # 4: Quit
- Ends the program
- The output should be 'Thank you for running this program'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started