Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
def display():
    for act in list:
        for key in act.keys():
            print(key, act.get(key))