21.3k views
0 votes
Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyramid with a rectangular base.

User Newage
by
4.8k points

2 Answers

6 votes

Answer:

Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyramid with a rectangular base.

Step-by-step explanation:

thats all you said

User Michael Conard
by
5.4k points
3 votes

In python 3.8:

def pyramid_volume(base_length, base_width, pyramid_height):

return round((base_length*base_width*pyramid_height)/3,2)

print(pyramid_volume(1,1,2))

I used the round function to round the volume to 2 decimal places. You can change this if you need more or less precision. I hope this helps!

User Florentino
by
4.7k points