0 out of 464 challenges solved

Calculate Loss Amount

Write a Python function `loss_amount(actual_cost, sale_amount)` that calculates the loss amount on a sale. If the sale amount is greater than the actual cost, the function should return the loss amount (difference between sale amount and actual cost). Otherwise, it should return `0`.

#### Example Usage
```python [main.nopy]
print(loss_amount(1500, 1200))  # Output: 0
print(loss_amount(100, 200))    # Output: 100
print(loss_amount(2000, 5000)) # Output: 3000
```
def loss_amount(actual_cost, sale_amount):
    """
    Calculate the loss amount on a sale.

    Parameters:
    actual_cost (float): The actual cost of the item.
    sale_amount (float): The sale amount of the item.

    Returns:
    float: The loss amount if sale_amount > actual_cost, otherwise 0.
    """
    # Implement the function logic here
    pass