A python dictionary, Bank, is created to keep track of the Current Account and the Savings Account for each client in a bank. While the first item in the list is for the current account, the second item is for the savings account. The client’s name acts as the key for this dictionary. Bank = {"Apple":[100.0, 1500.0], "Bobby":[200.0, 4000.0], "Cathy":[150.0, 3500.0], "David":[300.0, 2500.0]} Write the following functions for the dictionary Bank to maintain the clients’ current and savings accounts. 1. Function printBank( ): print out the contents of the dictionary Bank 2. Function deposit(Name, account_type, amount): deposit the amount of money to the account specified by the account_type under the client’s name. 3. Function withdraw(Name, account_type, amount): withdraw the amount of money from the account specified by the account_type under the client’s name. 4. Function creatAccount(Name): create a new entry in the dictionary and initialize both the current and savings accounts to 0.0 under the client’s name. 5. Function transferAllandDelete(Name1, Name2): transfer all the money from Name1 to Name2, the transfer should be done of the same account_type (i.e., current account to current account, savings account to savings account). After the transfer, delete all the accounts under Name1.
A python dictionary, Bank, is created to keep track of the Current Account and the Savings Account for each client in a bank. While the first item in the list is for the current account, the second item is for the savings account. The client’s name acts as the key for this dictionary.
Bank = {"Apple":[100.0, 1500.0],
"Bobby":[200.0, 4000.0],
"Cathy":[150.0, 3500.0],
"David":[300.0, 2500.0]}
Write the following functions for the dictionary Bank to maintain the clients’ current and savings accounts.
1. Function printBank( ): print out the contents of the dictionary Bank
2. Function deposit(Name, account_type, amount): deposit the amount of money to the account specified by the account_type under the client’s name.
3. Function withdraw(Name, account_type, amount): withdraw the amount of money
from the account specified by the account_type under the client’s name.
4. Function creatAccount(Name): create a new entry in the dictionary and initialize both the current and savings accounts to 0.0 under the client’s name.
5. Function transferAllandDelete(Name1, Name2): transfer all the money from Name1 to Name2, the transfer should be done of the same account_type (i.e., current account to current account, savings account to savings account). After the transfer, delete all the accounts under Name1.

Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 5 images









