← All projects

Beginner project · about 45 minutes

Bank Account Simulator 🏦

Classes, exceptions and a printed statement: deposits, withdrawals, overdraft rules and transfers between accounts.

This is the classic object-oriented starter and it comes up in interviews. The rules: no withdrawal may take a Current account below its overdraft limit, and a Savings account has no overdraft at all.

What you will build

  1. Account class owner, balance, overdraft (default 0), history list. deposit() and withdraw() append ("dep", amount) or ("wd", amount).
  2. Enforce rules withdraw raises ValueError("Insufficient funds") if balance - amount < -overdraft. Catch it where you call withdraw and print "Declined: ...".
  3. Transfers transfer(other, amount) withdraws from self then deposits into other.
  4. Statement Print each transaction with a running balance, right-aligned to two decimals.

Skills: classes, exceptions, formatting, lists