0 out of 464 challenges solved

Largest Triangle Inscribed in Semicircle

Write a Python function `largest_triangle_area(radius)` that calculates the area of the largest triangle that can be inscribed in a semicircle with a given radius. The largest triangle that can be inscribed in a semicircle is a right triangle with its hypotenuse as the diameter of the semicircle.

#### Formula:
The area of a right triangle is given by:

\[ \text{Area} = \frac{1}{2} \times \text{base} \times \text{height} \]

For the largest triangle inscribed in a semicircle, the base and height are equal to the radius of the semicircle.

#### Function Signature:
```python [main.nopy]
largest_triangle_area(radius: float) -> float
```

#### Input:
- `radius` (float): The radius of the semicircle. It is guaranteed to be a non-negative number.

#### Output:
- Returns the area of the largest triangle that can be inscribed in the semicircle.

#### Example Usage:
```python [main.nopy]
largest_triangle_area(2)  # Output: 2.0
largest_triangle_area(5)  # Output: 12.5
largest_triangle_area(0)  # Output: 0.0
```
def largest_triangle_area(radius: float) -> float:
    """
    Calculate the area of the largest triangle that can be inscribed in a semicircle.

    Args:
    radius (float): The radius of the semicircle.

    Returns:
    float: The area of the largest inscribed triangle.
    """
    # Placeholder for the solution
    pass