Create a program called "Geometry" Prompt the user for a small decimal number. Prompt the user for a large decimal number. Using those numbers as lower and upper bounds, randomly generate a decimal value between the two. Using the randomly generated number, calculate the VOLUME of a sphere if it were to have that size radius. Output the radius as well as the volume back to the user.

Respuesta :

Answer:

In Python:

import random

small = float(input("Small: "))

large = float(input("Large: "))

radius = round(random.uniform(small, large),2)

volume = round(4/3 * 22/7 * radius* radius* radius,2)

print("Radius: "+str(radius))

print("Volume: "+str(volume))

Explanation:

This imports the random module

import random

The next two lunes prompt the user for small and large decimal number

small = float(input("Small: "))

large = float(input("Large: "))

This generates the radius

radius = round(random.uniform(small, large),2)

This calculates the volume

volume = round(4/3 * 22/7 * radius* radius* radius,2)

This prints the generated radius

print("Radius: "+str(radius))

This prints the calculated volume

print("Volume: "+str(volume))

Note that, the radius and the volume were approximated to 2 decimal places. Though, it wasn't stated as part of the program requirement; but it is a good practice.

The Python program to compute a sphere's volume, given a random radius, is found in the attached image

The program first asks for the small decimal number, then the large decimal number. It then converts them to floating point values and stores them in the variables min_value and max_value.

To generate a random radius, we use the function uniform to generate a value in the range min_value < random_radius < max_value

Then, the volume of the sphere is computed using the formula

[tex]\frac{4\times \pi \times random\_radius^3}{3}[/tex]

Finally, the random radius and the volume are both displayed to two decimal places.  

Learn more about computing volumes in Python: https://brainly.com/question/19150697

Ver imagen batolisis