Files
qwen-image/example.py
mike 1dead1c666 aa
2026-06-18 00:06:15 +02:00

23 lines
584 B
Python

def calculate_area(length, width):
"""
Calculate the area of a rectangle.
Args:
length (float): The length of the rectangle
width (float): The width of the rectangle
Returns:
float: The area of the rectangle
"""
if length <= 0 or width <= 0:
raise ValueError("Length and width must be positive numbers")
return length * width
# Example usage
if __name__ == "__main__":
try:
area = calculate_area(5, 3)
print(f"The area is: {area}")
except ValueError as e:
print(f"Error: {e}")