def setUp(self): self.account1 = Account('Sally', 'Smith') self.account2 = Account('Sam', 'Jones') self.tomorrows_date = ( datetime.datetime.today() + datetime.timedelta(days=1)).date().strftime("%b %d, %Y")
def createAccount(): acconutName = input("請輸入開戶名稱: ") x = int(input("請輸入開戶金額: $")) acconut = act.Account(x) dict = {acconutName: acconut} list.append(dict)
import os import atm.Account as act #主程式 act1 = act.Account(1000) act2 = act.Account(1000) act3 = act.Account(1000) list = [{"john": act1}, {"merry": act2}, {"tom": act3}] # 列出所有人的帳戶餘額 def display(): for act in list: for key in act.keys(): print(key, act.get(key)) 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 createAccount(): accountName = input('請輸入開戶人名稱: ') x = int(input('請輸入開戶金額: $')) account = act.Account(x) dict = {accountName: account} list.append(dict)
def fake_account(): return Account( account_number=fake_account_number(), pin=fake_pin(), balance=fake_balance() )