Question: For this assignment you will create a Python script that calculates the diameter, circumference, surface area, and volume of a sphere. Your script should conform

For this assignment you will create a Python script that calculates the diameter, circumference, surface area, and volume of a sphere. Your script should conform to the following rules:

  1. Please name your script _sphere.py where is your last name.

  2. Take the radius of the sphere as input (as a floating-point number), after displaying an appropriate prompt.

  3. Computethespheresdiameter,circumference,surfacearea,andvolume. Use the following equations for reference.

Value

Equation

diameter circumference surface area volume

2 * radius diameter * PI 4 * PI * radius * radius 4/3 * PI * radius * radius * radius

  1. Use the math module to get the value of PI for your calculations. Do not use a literal PI string of your own. That is, do not use something like pi = 3.14159.

  2. Display the calculated diameter, circumference, surface area, and volume, each on a separate line and with appropriate text indicating what each value is. Each value should be rounded to 2 significant digits after the decimal place, using the round function.

As an example, when your script is run, it should take input and show output similar to the following (you can vary the text and formatting as you wish):

Enter the sphere's radius: 2.1 
Diameter : 4.2 Circumference : 13.19 Surface area : 55.42 Volume : 38.79 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!