An ordinary account must not spend more cents than it holds. Add that boundary to withdrawals.
withdraw(amount_cents) uses the same strictly positive integer rule as deposit, then checks the available balance. Withdrawing exactly the balance is allowed and leaves zero. More than the balance is rejected. Every rejected call raises ValueError before changing the balance; valid calls subtract once and return the new balance.
ValueError is the built-in exception used here to signal an unacceptable amount. The caller can catch it with except ValueError; you do not need a custom exception class.
The starter includes the completed previous stage. Only the new TODO body is unfinished; the earlier code and Console checks stay in place.
Account.withdraw(amount_cents) to enforce the amount and available-balance rules, return the remaining cents, and leave rejected withdrawals unchanged.Edit main.py, press Run, then Submit. The supplied probe also prints earlier checkpoints; its new output should be:
After withdrawal: 1100
The probe is supplied; you only need to finish the method. Submit checks other inputs as well.
Do both checks before subtracting. Equality with the current balance is valid.