Skip to content

Latest commit

 

History

History
10 lines (8 loc) · 193 Bytes

File metadata and controls

10 lines (8 loc) · 193 Bytes

Python 特性

断言

def apply_discount(product, discount):
    price = int(product['price'] * (1.0 - discount))
    assert 0 <= price <= product['price']
    return price