""" Exercise 7.2 from "A primer on..." Add functionality to the Account class. """ class Account: def __init__(self, name, account_number, initial_amount): self.name = name self.no = account_number self.balance = initial_amount self.transactions = 1 def deposit(self, amount): self.transactions += 1 self.balance += amount def withdraw(self, amount): self.transactions += 1 self.balance -= amount def dump(self): s = f'{self.name}, {self.no}, transactions: {self.transactions}, balance: {self.balance}' print(s) a1 = Account('John Olsson', '19371554951', 20000) a2 = Account('Liz Olsson', '19371564761', 20000) a1.deposit(1000) a1.withdraw(4000) a2.withdraw(10500) a1.withdraw(3500) print("a1 balance:", a1.balance) a1.dump() a2.dump() """ Terminal> python Account2.py a1 balance: 13500 John Olsson, 19371554951, transactions: 4, balance: 13500 Liz Olsson, 19371564761, transactions: 2, balance: 9500 """