Write a program named program51py that defines a valuereturn

Write a program named program51.py that defines a value-returning function named cuber that returns both the surface area and volume of a cube. A cube is a rectangular prism with all sides equal. Prompt the user to enter the cube\'s side length from the keyboard in the main function and then call the cuber function. The main function should \"catch\" the values returned by cuber and display both the surface area and volume accurate to three decimal places.
SAMPLE OUTPUT
Enter side length of cube 2.5
Surface area is 37.500
Volume is 15.625

Solution

def cuber(l):
    sa = round(6*l*l,3)
    v = round(l*l*l,3)
    return (sa,v)
l = float(input(\'Enter side length of cube \'))
s=cuber(l)

print (\"Surface area is:\",s[0])

print (\"Volume is\",s[1])

output:-

Enter side length of cube 2.5
Surface area is 37.500
Volume is 15.625

Write a program named program51.py that defines a value-returning function named cuber that returns both the surface area and volume of a cube. A cube is a rect

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site