$30
CSC 242: Introduction to Computer Science II
Lab exercise set 3
Logistics
These exercises should be completed during the lab session. In order to receive full credit for the
lab, submit a file that contains solutions to all these exercises
You are encouraged to work in groups on lab exercises. If you do work with someone, you must
include the name(s) of your collaborator(s) at the top of the file you submit. For more
information about collaboration policies in this class, see the Academic Integrity policy.
If you complete the lab exercise early, please review Chapter 8 and read Chapter 9 in the
textbook and work on the fourth assignment. You are only allowed to work on assignments with
at most two-other people, either directly or indirectly, who must be formally identified as part of
your assignment submission.
Exercise
1. Implement a container class Stat that is a subclass of object. The class stores a sequence
of numbers and provides statistical information about the numbers. It supports an
overloaded constructor that initializes the container either using a list or with no
parameter which creates an empty sequence. The class also includes the methods
necessary to provide the following behaviors:
This class also implements the == operator (__eq__). It returns true if the SUM of the values is
the same. Example:
Note that part of the exercise is to determine which methods you need to implement in order
to obtain the functionality shown above. Ask the lab assistant if you get stuck on any of
the methods. Look the behaviors above carefully. Notice what happens if you try to add
a value that is not a number.
Submitting the exercises
You must submit your solutions to the exercises using the lab 3 dropbox on the D2L site. Submit
only a single Python file (e.g. csc242lab3.py) with each of the completed functions and classes
for the lab exercises in it. Submissions after the deadline listed above will be automatically
rejected by the system. See the syllabus for the grading policy.
Grading
The lab session is worth 10 points.
If you complete the lab exercises before the end of the lab session, please work on the third
assignment. Remember that the rules for collaboration on assignments is different from labs.
Please review the Academic Integrity policy for more information. If you have questions about
the assignment, please ask the teaching assistant for help.