Section 5 X
https://learn.zybooks.com/zybook/DREXELCS171Winter2024/chapter/5/section/6
Booking.com McAfee Security LastPass password.. Amazon.com-Onli. LastPass G The Warren Court untitled
zyBooks catalog Help/FAQ Anthony Tucker?
My library > CS 171: Computer Programming I home >
5.6: Lab 2E - Volume and Area of a Cylinder
The volume and area of a cylinder are calculated as:
\( \text{Volume} = \pi r^2 h \)
\( \text{Area} = 2 \pi rh + 2 \pi r^2 \)
Given the radius and height of a cylinder as floating-point numbers, write a program which outputs the volume and area of the cylinder.
Hint: Use the constant pi from the math module in your calculations.
For this lab, you should write two functions, getVolume(radius, height) and getArea(radius, height), which receive the necessary numeric
inputs and return precise outputs. Do not round within these functions - do your rounding when you print out the values.
Output each floating-point value with two digits after the decimal point using the following statement:
print (f'Volume (cubic inches): {yourValue:.2f}')
Ex: If the input is:
5.2
8.1
where 5.2 is the radius of the cylinder and 8.1 is the height of the cylinder, then the output is:
Volume (cubic inches): 688.08
Surface area (square inches): 434.55