Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions