0 out of 464 challenges solved
Write a Python function to calculate the surface area of a square pyramid given its base edge length and height.
The surface area of a square pyramid can be calculated using the formula:
\[ \text{Surface Area} = b^2 + 2 \cdot b \cdot s \]
Where:
- \( b \) is the length of the base edge.
- \( s \) is the slant height of the pyramid.
#### Example Usage
```python [main.nopy]
surface_area = calculate_surface_area(3, 4)
print(surface_area) # Output: 33
surface_area = calculate_surface_area(4, 5)
print(surface_area) # Output: 56
```def calculate_surface_area(base_edge: float, slant_height: float) -> float:
"""
Calculate the surface area of a square pyramid.
Args:
base_edge (float): The length of the base edge of the pyramid.
slant_height (float): The slant height of the pyramid.
Returns:
float: The surface area of the square pyramid.
"""
# Implement the formula for the surface area of a square pyramid
pass