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!