Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
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 ar: and surface area by 4tr2. 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.1592653589793Step 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