Due at 4 PM. For assignment due dates see the main schedule on the course webpage. The program must be written and run under python version 3.X.
Write a program that consists of two functions (in addition to a start() function).
fileRead (Worth 3 GPA):
Synopsis: This function will read the first seven numbers (one number for each day of the week, each stands for Calgary job numbers) into the each row of the list. Your program will ignore the remaining information on that row of the input file. It will then continue reading, line by line, job numbers into a new row of the list. (That is the list containing the job numbers will be dynamically created with the number of rows in the list matching the number of rows of job numbers in the input file specified by the user when the program runs). [One example of a possible input file]
Breakdown of the 3.0 credit:
- Prompt the user for the name of the input file & if the file is empty it will display an error message. (0.5 GPA)
- Open the input file and only read the job numbers for Calgary into the list, other information is ignored. (2 GPA)
- If there is any problems associated with the file (cannot open, file is empty, there is an error during the read process) then the program will display an appropriate error message and repeatedly prompt the user for the name of the input file and begin the file read process anew. (0.5 GPA)
The input file contains job numbers for Calgary and Edmonton.
- The first row is a heading and should not be read into the list.
- The second and successive rows contains a week of job numbers.
- There will be 7 numbers each followed by a space for Calgary followed by a tab which is followed by 7 numbers for Edmonton.
Here is the data show in the example input file. You program must be able to handle an input file with 1 or more weeks worth of numbers.
display (Worth 1 GPA)
The list will be displayed with each row displayed on its own line. (0.3 GPA) Each element (number) will be followed by a dash. (0.3 GPA) When a row of numbers has been displayed the total for that row will be displayed at the end of the row. (0.4 GPA) Here is the output using as input the sample input file (the first line in the image shows the user being prompted for and entering the name of the input file and isn't part of the list data).
In order to make marking reasonable, in order to get credit for the first function the display function must be able to display the 2D list even if the display function does not quite fill requirements described above. The main thing is to get any credit for the function that reads from the file the marker must be able to see the output of the list e.g. of a display function that shows the list data but poorly - the following instruction is imbedded in a loop print(jobNumbers[i]). This latter crude approach may allow you to be awarded credit for the file read function (but nothing for the display function).
Open the input file using Word (you should be able to access Word via the student license for Office 365 (although the specific location in that version of Word may be slightly different for invoking the feature to display formatting marks) without charge while you are U of C student) and turn on 'Formatting marks'
Home ribbon -> (Paragraph group) and click on the Show/Hide icon
Characters that aren't visible such as spaces, tabs and the newline (enter) appear in this display mode
The TAs will cover an example
called 'fileReadIntoList' during the week of June 6 - 12 that you
may find extremely useful for this assignment and for the second part of the
project. so you should make special effort to attend
tutorial that week.
You are to submit your assignment using D2L [help link]. Make sure that you [check the contents of your submitted files] (e.g., is the file okay or was it corrupted, is it the correct version etc.). It's your responsibility to do this! (Make sure that you submit your assignment with enough time before it comes due for you to do a check). If don't check and there were problems with the submission then you should not expect that you can "learn your lesson" and simply resubmit.
Please make sure you submitted it properly before the deadline (the onus is on you to do this).
If you don't do this:
D2L will "cut you off" after the deadline (and you get zero credit).
Don't try to email to the marker or myself after the deadline because bypassing requirements like this won't allow you to be awarded credit.
Assignments must reflect individual work; group work is not allowed in this class nor can you copy the work of others. Some "do nots" for your solution: don't publically post it, don't email it out, don't show it to other students. For more detailed information as to what constitutes academic misconduct (i.e., cheating) for this course please read the following [link].
Unless otherwise told you are to write the code yourself and not use any pre-created functions (or methods). For most assignments the usual acceptable functions include: print(), input() and the 'conversion' functions such as int(), float(), str(). Look at the particular assignment description for a list of other functions/methods that you are allowed to use and still get credit in an assignment submission. If it's not listed then you should assume that you won't be able use the function and still be awarded credit.