Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP 636: Programming Exercises for Assessment
Submission Instructions:
Submit one Python (.py) file for each question (1,2).
Ensure that your name and student id are included in a comment at the top of the file.
Mark Allocation:
Question 1) 5 Marks
Question 2) 15 marks
Marks are awarded for
• Functionality
• Code Quality
• Comments
Exercise Questions
1 Download the coursecode.py file from the Learn page. This file contains a function that is
supposed to check if a course code is correct according to the following rules:
The first four characters should be letters, then a space, then a three digit number.
The number can start with a 1,2,3,4 or 6
The letter code can be one of “COMP”, “LASC”, “ENGN”,”ERST”,”LINC”,”ECOL”,”MGMT”,”COMM”
The file contains a number of logic/programming errors. Devise a series of test inputs to detect these
and correct the errors that you uncover.
2. Download the fitness.py file from the Learn page. This file contains the skeleton of a program to
add classes to a gym and to enrol members in a fitness class.
Add to the existing system so that
1. New classes can be added to the gym
2. A list of classes can be displayed
3. Members can be enrolled in a class
4. A register for a class can be displayed
Notes:
Ensure that you include your name and student id at the top of the file.
The provided file, contains a menu structure and helper functions, these should not be deleted or
renamed.
The “pass” keyword is used in the menu if statement, this can be removed/changed as you add your
own code.
Two dictionaries are provided, these should be used for data storage. classLimits should store class
names with the enrolment limit (number) for that class. classRegister should store the list of
members who a enrolled in the class.
When a class is added, it should be added to both dictionaries.
When a class is added, it should have an enrolment limit specified, this should be stored in the
classLimits dictionary.
There are no requirements for a gym class name to meet
There are no requirements for a members name to meet.
You should check the enrolment limit before adding someone to a class.
Add comments to your code. The existing comments give some hints about the behaviour
expectations of each function.