Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I wrote this code with Pycharm, there are some bugs, can someone help me correct it? elif shape == e or shape == ellipsoid: x

I wrote this code with Pycharm, there are some bugs, can someone help me correct it?

image text in transcribedimage text in transcribed

elif shape == "e" or shape == "ellipsoid": x = float(input("Please enter the radius x: ")) y = float(input("Please enter the radius y: ")) z = float(input("Please enter the radius z: ")) ellipsoidlist.append(volumes.volumeEllipsoid(x,y,z)) elif shape == "q" or shape == "quit": break else: print("Invalid input") print("You have reached the end of your session. The volumes calculated for each shape are:") if len(cubelist) == 0: print("Cube: No shapes entered") else: sumcube = sum(cube list) maxcube = max(cubelist) mincube = min(cubelist) print("Cube: ", sumcube, maxcube, mincube) if len(ellipsoidlist) == 0: print("Ellipsoid: No shapes entered") Felse: sumellipsoid = sum(ellipsoidlist) maxellipsoid = max(ellipsoidlist) minellipsoid = min(ellipsoidlist) print("Ellipsoid: ", sumellipsoid, maxellipsoid, minellipsoid) Run: A H ICE D1- * main Please enter the radius z: 3 Please enter a shape: 9 You have reached the end of your session. The volumes calculated for each shape are: Cube: No shapes entered Traceback (most recent call last): File "/Users/liuyunqing/Documents/main.py", line 45, in sumellipsoid = sum(ellipsoidlist) TypeError: unsupported operand type(s) for +: 'int' and 'str' Process finished with exit code 1 def volumeEllipsoid(x,y,z): volume E = math.pi * X * Y * Z* 4 / 3 return "0.2f"%(volumeE)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions