To the faculty page of James Tam Return to the course web page

CPSC 217: Mini-Assignment 3C

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.

New Concepts to be applied for the assignment

Only new concepts that need to be applied in the assignment are listed, concepts previously applied in other assignments may need to used in the implementation of your solution.

Functional requirements

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 number stands for  Calgary job numbers) into each row of a 2D list. Your program will ignore any information that comes after these numbers on a row. The job numbers for a particular day is only a single digit long.  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. The name of the input is specified by the user when the program runs). [One example of a possible input file]

Breakdown of the 3.0 credit:

The input file contains job numbers for Calgary and 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. Because the list containing the job numbers is created dynamically, your program should be able to process a file with any number of rows.

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 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 file input function the display function must be able to display the 2D list even if the display function does not quite fill requirements for display function.  That is, you won't get credit if your program reads the information into the list but doesn't display any output because the marker can't quickly tell if your file code is properly reading the information into the list. It's far faster for the marker to evaluate your program by running it and viewing the results rather than hand tracing code (the latter of which they will not do).  But that's not a tough requirement to meet. The main thing is to get any credit for the file function the marker must be able to see the output of the list. For example, you have the following instruction imbedded in a loop:

# A loop with 'r' as the loop control stepping through the rows in the list
print(jobNumbers[r]).

This latter crude approach may allow you to be awarded credit for the file read function (but nothing for the display function).

Summary:

Hint (seeing the invisible characters in a text document).

Open the input file using Word (you should be able to access Word via the student license for Office 365 without charge while you are U of C student) and here's how you turn toggle the display of 'Formatting marks':

Characters that aren't visible such as spaces, tabs and the newline (enter) appear in this display mode. Here's how to see formatting marks in MS-Word on an Apple computer (because the university is unable to provide a MAC to the course instructor the correctness of the contents of this link could not be verified): [Viewing formatting marks on a MAC]

Bigger hint

In tutorial the TAs will cover an example called '3fileReadIntoList.py' (linked in here for your convenience) 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 should still practice applying good style in your solution as well as writing documentation. Unlike the full assignments you will be just graded on program functionality for the mini-assignments.

Non -functional assignment requirements (style and documentation).

Although it won't affect your grade for mini-assignments you should still practice applying good style in your solution as well as writing documentation. It will keep your skills for the full assignments (when you will be graded on these things) and get you used to having good habits.

Marking and grading

Collaboration:

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].

Method of submission:

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.

D2L configuration for this course

(Waived for fall 2022), Late submissions for full assignments  when there is no extension granted: Make sure you give yourself enough time to complete the submission process so you don't get cut off by D2L's deadline (or your submission will be automatically flagged as late by D2L and it will be graded appropriately)..

Submission received:

On time

Hours late : >0 and <=24

Hours late: >24 and <=48

Penalty:

None

-1 GPA

-No credit (not accepted)

 

Use of pre-created Python libraries:

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.