Using python,Write two functions which will take required arguments for calculating the Area and Volume ofcylinder.note:- The format should be:print("the volume of the cylinder is{0:.{1}}cm\u00b3".format(volume,decimals))
Answers
Answered by
0
Two functions are volume(r, h) and area_cylinder(r,h)
Explanation:
Python Program
def volume(r, h):
pi = 3.14
vol = pi * r ** 2 * h
decimals = 3
print("The volume of the cylinder is {0:. {1} f} cm \u00b3 ". format(vol, decimals))
def area_cylinder(r,h):
pi = 3.14
surface_area = 2 * pi * r * h + 2 * pi * (r**2)
decimals = 3
print("The area of the cylinder is {0:. {1}f}cm\u00b2". format(surface_area, decimals))
volume(1,2)
area_cylinder(1,2)
Output:
The volume of the cylinder is 6.280cm³ The area of the cylinder is 18.840cm²
Similar questions