Solución

@jesusepulvettl_c6e0b000·26/8/2026TypeScript
solution.tsTypeScript
class Rectangle:
    def __init__(self, width: float, height: float) -> None:
        self.width = width
        self.height = height

    def area(self) -> float:
        return self.width * self.height if self.width and self.height else None

    def perimeter(self) -> float:
        return 2 * (self.width + self.height) if self.width and self.height else None


def get_rectangle_metrics(width: float, height: float) -> dict:
    rectangle = Rectangle(width, height)
    return {'area': rectangle.area(), 'perimeter': rectangle.perimeter()}
0respuestas
Respuestas

Aún no hay respuestas

¡Sé el primero en responder!

Escribir un comentario

Recuerda ser amable. Estás comentando la solución de otra persona. Comparte tu perspectiva de forma constructiva y respetuosa.

Debes iniciar sesión para publicar un comentario.