This assignment requires you to work with some lists and to explore some common algorithms. You will be working with a list of bank records which contain details of individual bank customers and their accounts.
You will be required to provide a hardcopy of a written report (a word document) with some of your answers. You will also be required to hand the whole assignment (both code and reports) in electronic form.
Download the files bank.txt and assignment2.py. The file bank.txt is the input file for the program. It consists of a number of lines of text, each with five fields. These fields are:
Assignment2.py already has some functionality added - ignore that for the moment.
For each of the following functions provide the expected inputs, outputs and pseudocode in your report (note: you will probably find the assignment easier if you do this BEFORE you do your coding)
Write a new function (called readInputFileIntoList) which will read the file bank.txt and place individual customers records into a list (effectively a 'list of lists'). The function should NOT take the bank list as a parameter. It should return the bank list via its return statement.
You may not assume that you know how many records are in the input file - it must work for any number of lines.
For each line in the input file you should create an individual list with five elements (listed above). Use the 'split' function to help you with this. Once you have created this list, add it to the bank list. The result of executing readInputFileInfoList should be a list of bank records - one for each line in the file.
Write a function called 'printIndividualRecord'. It should take a list (corresponding to a single bank record) as a parameter. If the record is
Bruce Willis 123313 savings 405.00
the function should print out the details of the record in the following format
Bruce Willis has a savings account with account no: 123313. There is $405.00 in this account.
Write a function called 'printAllRecords', which calls printIndividualRecord for each record in the bank list. It should take the bank list as a parameter.
Examine the functions already authored in assignment2.py.
In the code, write a high-level description of what each of these functions is intended to do as a comment above the function code. This description should be no longer than five lines. Marks will be awarded according to how well your response reflects your understanding.
Examine the function 'sortListUsingSelectionSort' that has been written in assignment2.py. This function is not complete. Use the functions from task B to complete the implementation of this function. Note - it should not be necessary to move (change the order of) or delete the code that is already there. When complete the function should have sorted the list in descending order (biggest item first).
In the code (not the report) add a brief comment (1 or 2 lines maximum) to each line to explain how the line contributes to the implementation of the selection sort.
Also add a comment above the function to describe to someone else who might want to use it at a later time. This comment should be no longer than 5 lines.
Marks for the comments will be awarded according to how well they reflect your understanding of the code.
Write functions to perform the following tasks. Each function should be properly commented, use well-chosen identifier names and have appropriate parameters and any other good programming practices.