Question Details

(solution) Goals of this Assignment Use the Function Design Recipe to plan,

Goals of this Assignment

  • Use theFunction Design Recipeto plan, implement, and test functions.
  • Write function bodies using variables, numeric types, strings, and conditional statements. (You can do this whole assignment with only the concepts from Weeks 1, 2, and 3 of CSC108.)
  • Learn to use Python 3, provided starter code, a type-check module, and other tools.
Background Information

In this section, we describe a scenario to help explain what the program you will be writing does. Since we assume you have only been programming for a few weeks, we have made some adjustments to the code you will implement that are unrealistic but that make the problem easier to solve. We encourage you to pay attention to details and requirements you find unrealistic, and consider what you would need to be able to do to improve your program. You can read more about this in the "Going Further" section.

Most post-secondary institutions use some kind of computer system to help manage admissions. Often, these programs are used to handle straightforward admissions cases, freeing up human time to work on the more complex ones. The purpose of the system you are working on is to determine if students meet cutoffs for admission to degree programs and for consideration for scholarships.

Admission to degrees is based on marks in high school courses a student has taken. In our admission program, we are given two marks for every course in a student's application. The first mark is their grade on coursework, and the second is their grade on the final exam. Their final mark in the course is the average of those two marks.

In the 2016-2017 academic year, post-secondary institutions in Alberta needed to update their admissions systems to handle a special group of incoming students. In May 2016, out-of-control wildfires forced the evacuation of about 90000 people from Fort McMurray, a city in northern Alberta. This included students who were in their final year of high school, preparing to write final exams. Due to the evacuation, most students were not able to write their exams.

To accommodate students in this special situation, post-secondary institutions in Alberta changed the admission criteria for these students; they would be admitted based on their coursework marks up to the evacuation, and not on the coursework plus exam mark typically used. These special criteria were only applied to students who came from particular schools in the affected year.

Our Admission Process

This section describes the process our admission system will use.

Admission to a degree is based on the average of a student's final mark in up to three high school courses. The admission program contains a set of courses that can be used; not every course a student submits can necessarily be used for admission.

Each degree has its own cutoff for admission. Additionally, students whose average is 5% or more above the admission cutoff receive a scholarship.

Each student application is a record consisting of an ID number, the name of the student, the high school they attended, their graduation year, the three courses they wish to use for admission, and the degree they are applying to.

The admission system reports, for each student, the admission decision for their application to a particular degree. If a student applies for more than one degree, the system will have more than one record for them.

Terminology and Data

In this section, we define some of the information used in the admission system, and describe how the information is represented in the program.

  • student record: A student record consists of an ID number, the student's name, the high school they attended, their graduation year, a course record for each of the three courses they wish to use for admission, and the name of the degree they are applying to. In the Assignment 1 program, a student record is represented by a string, with each piece of information separated by a comma. You will see examples of student records in the provided code. You may assume that student records will only contain commas to separate information.
  • course record: A course record consists of a course code, a coursework mark, and an exam mark. In the Assignment 1 program, a course record is represented by a string, with each piece of information separated by a comma. For this assignment, you can assume that each mark is exactly two characters; for example,9and100are not possible marks.
  • transcript: A transcript consists of three course records. In the Assignment 1 program, a transcript is represented by a string, with each course record separated by a comma.
  • course code: A course code is a string of three characters that represents a course. Any string of three characters (other than a comma) is a valid course code.
  • degree: To avoid confusion between a computer program and an academic program of study, we use the word "degree" when referring to an academic program of study. In the rest of this handout, the word "program" refers to a computer program. For this assignment, the degree a student applied to is the last part of information in their student record: all of the characters after the last comma. The characters representing a degree may appear elsewhere in a student record. For example, a student may be named'Arthur'even if'Art'represents a possible degree.
Files to download

All of the files that you need to download for the assignment are listed in this section. These files must all be placed in the same folder. Download the files by right-clicking on the link and using your web-browser's "Save as" option. Do not use "cut and paste" as sometimes this can cause undesirable formating characters to be added to Python code.

  • Starter code is code that we provide for you to revise and turn into a complete assignment solution. The starter code for this assignment is in a file Complete it by following the instructions in theWhat to dosection of this handout (see below).
  • The main admissions program is in a file It is complete and must not be changed. More details on this code are given below.
  • The A1 type checker code is in a file Download and save this file. It is complete and must not be changed. More details on this code are given below.
What to do

In the starter code file, complete the function definitions for the functions listed in the table below. Use the Function Design Recipe that you have been learning. We have included the type contracts in the table; please read through the table to understand how the functions will be used. You can also take a look at the code in to see how the functions are used.

You should include full headers for each function. That includes the function description and examples described in the Function Design Recipe process. Please include at least two examples in your docstrings. You will need to paraphrase the full descriptions of the functions to get an appropriate docstring decscription -- not cut and past the full description from this handout.

Examination of the provided starter code file will show that it starts with the definition of some named constant variables which refer to the two schools and the year to which the special criteria apply, and a complete docstring for the is_special_case function. In your Assignment 1 solution, do not change the code that we have provided. You are to add your Python statements to this starter code file and fulfill the requirements listed in the table below.

If you examine, you will notice that only five of the six functions below are called in that file. The sixth function will be called by one of the functions you write, and there will be some marks allocated for correctly determining the usage.

(str) -> bool
The parameter represents a student record. Return True if and only if the student should be handled using the special case rules. Recall that for our admission system, a special case is a student who graduated from one of the specified high schools in the affected year.

Use the constants representing these values included in the starter code.
(str, str, str) -> float
The first parameter represents a student record. The second parameter represents the mark that student got on their coursework for a particular course, and the third parameter represents the mark that student got on their exam for the same course. Return the student's final mark in the course, with adjustments made if the student is a special case.
(str, str) -> str
The first parameter represents a record for a course, and the second parameter represents a course code to find marks for. If the course record matches the desired course, return a string containing the coursework mark and the exam mark separated by a single space. Otherwise, return the empty string.
(str, int) -> str
The first parameter represents a student transcript, consisting of one or more course records. The second parameter represents the course to extract from the transcript, with the first course in the transcript being course 1, the second being course 2, etc. You may assume that the second parameter has a value of at least 1.
(str, str) -> bool
The first parameter represents a student record, and the second parameter represents a degree. Return True if and only if the student represented by the first parameter applied to the degree represented by the second parameter.
(number, number) -> str
The first parameter represents a students' average in courses that can be considered for admission. The second parameter represents a cutoff for a degree. Return 'accept' if the average is at least the cutoff but below the threshold for a scholarship, 'accept with scholarship' if the average is at or above the threshold for a scholarship, and 'reject' if the average is below the cutoff.

NOTE: Copy and paste the strings to return carefully. Spelling, spacing, and case all matter here! Also, Be sure to use the typechecker!
Using Constants

Your code should make use of the provided constants. If the value of one of those constants were changed, and your program rerun, your functions should work with those new values.

Your docstring examples can reflect the values of the constants in the provided starter code, and do not need to change if we change the values of the constants.

You should also create your own constants and use those in place of literal strings like 'NE' or 'accept' in your code.

What NOT to do

Your file should contain the starter code, plus the function definitions specified above. Your file must not include any calls to function print or input. Also, do not include any extra code outside of the function definitions, and do not import any modules (you won't need them).

Want to earn a good mark? Test your work!

You should carefully verify your code before submitting to determine whether it works: the Test step of the Function Design Recipe is particularly important for assignments. Once the deadline has passed, we will run our own set of tests on your submission.

To test your work, you should call on each function with a variety of different arguments and check that the function returns the correct value in each case. This can be done in the shell or using another .py file, but must not be done in your submitted file.


We are providing a type-check module that can be used to test whether your functions have the correct parameter and return types. The purpose of this module is to help you make sure that we will be able to test your code. To use the typechecker, place and in the same directory and run

  • If the type-check module reports a message that starts withHooray! The type checker passed!: Your function parameters and return types match the assignment specification.This does not mean that your code works correctly in all situations.We will do a thorough job of testing your code once you hand it in, so be sure to thoroughly test your code yourself before submitting.
  • Otherwise:Look carefully at the message provided by the type-check module. The error messages are there to help you! Most likely, one or more of your parameter or return types does not match the assignment specification. It's also possible that your code doesn't meet some other requirement of the assignment. Fix your code and re-run the type-check module tests. The type-checker checks each function in the order they are listed in this handout, so you can use it to check each function as you write it.

Make sure the type-check module tests pass on every function you have written before submitting your solution! Again, this doesn't mean your code works correctly in all situations, but it does mean we will be able to run our marking tests on your code.

Going Further (optional)

This assignment is designed to be doable with only the concepts we see in the first few weeks of the course. This means that there are a lot of choices we made in designing this system that could be improved on as we learn more concepts. You are encouraged to think about ways in which you could improve the entire system (both the functions and program files) with additional concepts.

You will notice that there is code in that we have not yet talked about in class. If you are finding this assignment pretty straightforward, we encourage you to figure out how the program code works, and to then think about how to improve it. By the end of this course, you will be able to understand all of the code in, and likely even be able to think of ways to improve it! You may also think of better ways to represent the data in the program.

Important: Your code will be evaluated on how it meets the function descriptions above. While we encourage you to think about how to improve the program, do NOT submit these improvements as part of your Assignment 1 submission.



SPECIAL_CASE_SCHOOL_2 = 'Father Mercredi'




# Add other constants here


def is_special_case(record):


""" (str) -> bool


Return True iff the student represented by record is a special case.


>>> is_special_case('1,Jacqueline Smith,Fort McMurray


Composite,2016,MAT,90,94,ENG,92,88,Bachelor of Arts')




>>> is_special_case('2,Jacqueline Smith,Father Something


School,2016,MAT,90,94,ENG,92,88,Bachelor of Arts')




>>> is_special_case('1,Jacqueline Smith,Fort McMurray


Composite,2015,MAT,90,94,ENG,92,88,Bachelor of Arts')






# Complete the body of the function here


# Complete the rest of the functions here


Solution details:

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .

About this Question






Sep 13, 2020





We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.


Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.


Order Now