def cancelAccount(): cancelName = input('請輸入解約人:') cancelAccount == None: for act in list.keys(): if key in act.keys(): if key == cancelName: cancelAccount = act.get
def wirthdraw(): actName = input("請輸入提款人") x = int(input("請輸入提款金額")) #得到提款人的 account 物件 account = None for act in list: for key in act.keys(): if key == actName: account = act.get(key) if account == None: print("查無此人") else: account.withdraw(x)
def save(): actName = input("請輸入存款人") x = int(input("請輸入存款金額")) #得到存款人的 account 物件 account = None for act in list: for key in act.keys(): if key == actName: account = act.get(key) if account == None: print("查無此人") else: account.save(x)
def withdraw(): actName = input('請輸入提款人: ') money = int(input('請輸入提款金額: ')) # 得到存款人的account物件 account = None for act in list: for key in act.keys(): if key == actName: account = act.get(key) if account == None: print('查無此人') else: account.withdraw(money)
def transfer(): fromName = input("請輸入轉帳人(from): ") toName = input("請輸入被轉帳人(to): ") x = int(input("請輸入轉帳金額")) fromAccount = None toAccount = None for act in list: for key in act.keys(): if key == fromName: fromAccount = act.get(key) if key == toName: toAccount = act.get(key) if fromAccount == None or toAccount == None: print("查無此人") else: fromAccount.transfer(x, toAccount)
def display(): for act in list: for key in act.keys(): print(key, act.get(key))