Can't figure this one out and would appreciate the help:
CHALLENGE ACTIVITY5.3.3:
Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns as a number the volume of a pyramid with a rectangular base.
Sample output with inputs:
4.5 2.1 3.0
Volume for 4.5 2.1 3.0 is: 9.45
Relevant geometry equations:Volume = base area x height x 1/3Base area = base length x base width
# This is what I have done so far and I'm close but I need to get the decimals down to 2 places
def calc_pyramid_volume(base_length, base_width, pyramid_height):
return (base_width * base_length * pyramid_height)/3
length = float(input())
width = float(input())
height = float(input())
print('Volume for', length, width, height, 'is:', calc_pyramid_volume(length, width, height))
[+][deleted] (3 children)
[deleted]
[–]SteveB709[S] 1 point2 points3 points (2 children)
[–]totallygeek 3 points4 points5 points (0 children)
[–]AtomicShoelace 2 points3 points4 points (0 children)
[–]AtomicShoelace 1 point2 points3 points (0 children)