Question: Python Help with function find_account My code so far: https://pastebin.com/Ef5X40P1 Edit the bank.py file and add a function called find_account. This function has a single

 Python Help with function find_account My code so far: https://pastebin.com/Ef5X40P1 Edit

Python Help with function find_account

My code so far: https://pastebin.com/Ef5X40P1

Edit the bank.py file and add a function called find_account. This function has a single parameter which is the account number. The function retrieves the account from the accounts dictionary, if it exists. Use the dictionary.get(key function to retrieve the account. Remember how the get function works: it returns the value if the key is found in the dictionary, or None if it does not exist. This function needs to use the global accounts variable, so declare that variable global at the beginning of this function. If the account exists, return a tuple of ('account', _____), where the blank is the account that was found - the whole account dictionary. If the account does not exist, return a tuple of ('error', 'no such account', _____), where the blank is the requested account number. To test it, you can either type some statements into the main function, or just run the main function from Python manually. >>> import bank main() >>> find_account(123) (' account', {'bal': 10 'name': 'Jeff', 'num': 123}) >>> find_account(555) ('error', 'no such account', 555)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!