Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program named program51.py that defines a value-returning function named

ID: 3938158 • Letter: W

Question

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

Explanation / Answer

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote