The Program - PYRAMID CALCULATIONS - provides the user capability to calculate the volume of a pyramid. The project calculates the surface and volume of a square pyramid. A square pyramid has a square base, and all triangle faces are congruent isosceles triangles. (An isosceles triangle is a triangle in which two of the sides are equal.) Here is a picture of a square pyramid, a picture of one that shows various labeled lines, and the related equations for this problem.
- Length of the base: a
- Height of the pyramid: h
- Volume = a2h/3
- Slant height, s = sqrt(h2 + (a/2)2) This is the
- Pythagorean Theorem part.
- Area of one pyramid side = s*a/2
For this program, there are two things about a square pyramid:
- The surface Area of the four sides ( Do not include the surface area of the base) and
- The volume.
There should be an attached document( a Word or Excel file will do) that shows your hand calculations for the surface area and volume of these two pyramids:
- 1: Height: 5.0' Base: 2.5'
- 2: Height: 2.5' Base: 4.3'
Show the work, not just the result. Use these test cases to test your program and verify that it is returning the correct results.
To start writing code, run Python like we did in the lecture. Select File > New File

To run the program after it is written, click on Run > Run Module. The math.sqrt function should be imported. Pay attention to the order of operations in math formulas. Parentheses may be needed to force the correct order of operations To see output with a program, you have to use the print statement. Programs do not automatically output the results of expressions the same way the interactive interpreter does.