Question
Question: In python I am writing this code but it is not producing the right output I want for picking the shape how can I
Question: In python I am writing this code but it is not producing the right output I want for picking the shape how can I fix that? Also how would I begin the other parts for each of the shapes.
Write a program that first prompts the user to choose one of the following 3-d shapes:
- a octahedron
- a right circular cone
- a sphere
- a cube
You should prompt the user and then wait for their input. When the user enters an invalid shape, you should print a warning and then prompt them again. When they enter a valid selection, the program should continue.
Next, prompt the user to choose what to calculate:
- surface area
- volume
You should prompt the user and then wait for their input. When the user enters an invalid calculation, you should print a warning and then prompt them again. When they enter a valid selection, the program should continue.
Next, depending on which shape the user entered, ask for the shape's dimensions. All values for shape dimensions should work for floating point numbers. After you have all the appropriate information, output the requested data. Add labels for all inputs and outputs. The output should be similar to the sample output in the sample runs below. You do not need to check for bad input during this phase.
Code:
import stdio import math import sys
print("Welcome to Geometric Calulator")
print( " " )
while True: print("Enter a shape:"' ' + "1 = octahedron"' ' + "2 = cone"' ' + "3 = sphere"' ' + "4 = cube"' ' )
shape = stdio.readInt()
if shape == 1: print("You picked Octahedron") break
elif shape == 2: print("You picked Cone") break
elif shape == 3: print("You picked Sphere") break
elif shape == 4: print("You picked Cube") break
else: print("You picked a number outside of range. Try Again!")
print("Enter a shape:"' ' + "1 = octahedron"' ' + "2 = cone"' ' + "3 = sphere"' ' + "4 = cube"' ' )
shape = stdio.readInt()
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