Q. Write a function to calculate volume of a box with appropriate default values for its parameters .Your function should have the following input parameters:

(a) length of box ;

(b) width of box ;

(c) height of box.

Test it by writing complete program to invoke it.


You can understand by Watching video :-



Answer :-

def vol( l = 1, w = 1 , h = 1 ) :
    return l * w * h

length = int(input("Enter the length : "))
width = int(input("Enter the width : "))
height = int(input("Enter the height : "))

print("volume of box = ", vol( length , width , height ))

Output :-

Enter the length : 5
Enter the width : 2
Enter the height : 3
volume of box =  30

>>>

Enter the length : 84
Enter the width : 69
Enter the height : 75
volume of box =  434700

>>> 

Enter the length : 1
Enter the width : 1
Enter the height : 1
volume of box =  1

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post