Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One file contains account balance information for each customer of the bank. Each line of this file contains three data items: A customers social security

One file contains account balance information for each customer of the bank. Each line of this file contains three data items: A customers social security number (SSN), the bank account number, and the balance at the end of the previous business period (this might be a month, a week, or a day, but the actual length of the business period is not relevant for our purposes). The SSN is a string of digits in the usual format xxx-xx-xxxx, 2 the bank account number is simply a three digit number (unique to each customer), and the balance is a floating point value.

The second file contains all the bank transactions that have taken place in the current business period for all the customers at the bank. Each line of this file contains just two data items: a bank account number and the dollar amount of the transaction. If the transaction is a deposit, it is indicated as a positive value and if it is a payment (withdrawal), it is indicated as a negative value. A customers bank account number may appear several times in the file (if they had several transactions during the business period) or may not appear at all (if they did not carry out any transactions at the bank during the business period). A transaction is simply recorded at the time that it takes place, hence the account numbers may appear in any order in the file and all the transactions for a particular account may not appear together (that is, on consecutive lines) in the file.

Implement a python function called customer dictionary with a single parameter balfilename, the name of the file containing current account balance information for the customers of the bank in the format described above The function should open balfilename for reading. It should then create a dictionary with key:value pairs in which the key is the bank account number of a customer, and the value associated with a key is a list containing the SSN and the account balance for that customer. The function must return the dictionary. Remember to close the file prior to the return statement.

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

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

(Appendix) What are sales returns? Why do sales returns occur? LO86

Answered: 1 week ago