Skip to content

Instantly share code, notes, and snippets.

import math
def total_cost(amount):
return int(math.ceil(amount + 0.5 + 0.01 * amount))
def reduce_balance(balance, amount):
if amount < balance:
balance -= total_cost(amount)
return balance