Python代写-COMP 636
COMP 636: Programming Exercises for Assessment
Due: 9am Tuesday 27th April 2021
Submit via Learn@Lincoln
These exercises are worth 20% of the course marks for COMP 636.

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.
Submit your files via the submission links on the COMP 636 Page of the Learn@Lincoln Site.

Mark Allocation:
Question 1) 5 Marks
Question 2) 15 marks

Marks are awarded for
• Functionality
• Code Quality
• Comments

Exercise Questions

1 Download the 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 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

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

Use a list (array) in the classRegister dictionary to store the list of participants.
You can add additional functions as helper functions.
Don’t forget about the global keyword when working with data structures in functions.