Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python question using thonny... please answer asap Question 3 [25 points) A local museum is arranging for the transport of glass spheres from London for

image text in transcribed
image text in transcribed
image text in transcribed
python question using thonny... please answer asap
Question 3 [25 points) A local museum is arranging for the transport of glass spheres from London for an upcoming exhibition. To arrange for shipping and calculate costs, the museum received data on each sphere: its radius, volume and surface area. However, the file containing the data was corrupted after a ransomware attack. Now, the museum only knows one piece of data about each sphere: either the radius, the volume, or the surface area. You must write a program that asks the user which piece of data is present for a sphere (radius, volume, or surface area), and then, using that piece of data, calculate the two other missing pieces of data for that sphere. Finish by printing all three pieces of data (radius, volume and surface area) to the screen. Recall that the volume of a sphere with radius r is given by #r and surface area by 4r. If the user does not type in one of 'radius', 'volume', or 'surface area' when asked, or if the user enters a negative number when asked to type the value, your program should print 'Invalid input!' and stop (without printing anything else). You can assume that when asked to type the value, the user will always enter a number (no letters or symbols). Hint: Try writing code that just handles the case where 'radius' is entered. Once you have perfected that, start on the case where 'volume' or 'surface area' is entered. Filename You must write this program in a file called sphere.py. User input A string for the piece of data that was not corrupted ('radius', 'volume' or 'surface area"). The value (number) for that piece of data. (You can assume the user will always enter a number.) Examples (as executed in Thonny) EXAMPLE 1: >>> %Run sphere.py What piece of data do you have? radius Enter the number: 5 You entered 5.0 for the radius. The volume is 523.5987755982989 and the surface area is 314. 1592653589793. EXAMPLE 2: >>> %Run sphere.py What piece of data do you have? volume Enter the number: 50 You entered 50.0 for the volume. The radius is 2.285390748670416 and the surface area is 65.63429036687326. EXAMPLE 3: >>> %Run sphere.py What piece of data do you have? Burface are Enter the number: 100 You entered 100.0 for the surface area. The radius is 2.8209479177387813 and the volume LP is 94.03159725795935. EXAMPLE 4: >>> %Run sphere.py What piece of data do you have? circumference Invalid input. EXAMPLE 5: >>> %Run sphere.py What piece of data do you have? radius Enter the number: -9001 Invalid input

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

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions