Inspired Python
◆◆◆
def withdraw_money(customer, amount):
assert customer['balance'] >= amount, \
f'Balance too low; cannot withdraw {amount}'
customer['balance'] -= amount
return customer['balance']
>>> withdraw_money({"balance": 100.0}, amount=150)
AssertionError: Balance too low; cannot withdraw 150
# And again, this time by running `python -O` to enable optimizations
>>> withdraw_money({"balance": 100.0}, amount=150)
-50.0