Suppose we want to calculate the volumne (in cubic cm) of a cylinder for which the radius of the base is R cm and the height is H cm. We will use the formula: volume = area of base * height. Rather than making a single large calculation and returning the result, you should practice dividing the work into two assignment statements, as explained in Chapter 1 of our textbook. A partial solution is provided. The last three lines of the partial solution are all incomplete. Add the code needed to correctly complete the function definition. Notice that the statement import math makes all the objects in the math module available; your code should use math.pi in calculating the area of the base. NOTE: Be sure your code returns a value (using a return statement); do not print the result. Use Python
Suppose we want to calculate the volumne (in cubic cm) of a cylinder for which the radius of the base is R cm and the height is H cm. We will use the formula: volume = area of base * height. Rather than making a single large calculation and returning the result, you should practice dividing the work into two assignment statements, as explained in Chapter 1 of our textbook. A partial solution is provided. The last three lines of the partial solution are all incomplete. Add the code needed to correctly complete the function definition. Notice that the statement import math makes all the objects in the math module available; your code should use math.pi in calculating the area of the base. NOTE: Be sure your code returns a value (using a return statement); do not print the result.
Use Python
Answer to the given question:
The required program in python is as below:
Step by step
Solved in 2 steps with 2 images