Created
September 7, 2018 19:29
-
-
Save g-leech/3aa38ee963146be4259ce13c2637eadf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://help.open.ac.uk/documents/policies/working-out-your-class-of-honours/files/50/honours-class-working-out.pdf | |
| # Only 2nd and 3rd year courses count. | |
| # Course, credits, grade, year | |
| courses = [ | |
| ["M343", 30, "Distinction", 3], | |
| ["M249", 30, "Distinction", 2], | |
| ["M248", 30, "Distinction", 2], | |
| ["MST210", 60, "Grade 2 Pass", 2] | |
| ] | |
| speculative = [ | |
| ["M346", 30, "Distinction", 3], | |
| ["M347", 30, "Grade 2 Pass", 3], | |
| ["M373", 30, "Grade 2 Pass", 3], | |
| ] | |
| data = courses + speculative | |
| def is_first(data) : | |
| return is_light_weight(data) and qa(data) | |
| def is_light_weight(data: list): | |
| FIRST_WEIGHT = 630 | |
| second = score_year(data, 2) | |
| # weighted twice as much as 2nd year | |
| third = 2 * score_year(data, 3) | |
| print(second + third) | |
| return (second + third) <= FIRST_WEIGHT | |
| def score_year(data, year): | |
| dat = [x for x in data if x[3] == year] | |
| ones = [x[1] for x in dat if x[2] == "Distinction"] | |
| twos = [x[1] for x in dat if x[2] == "Grade 2 Pass"] | |
| threes = [x[1] for x in dat if x[2] == "Pass"] | |
| return sum(ones * 1 \ | |
| + twos * 2 \ | |
| + threes * 3) | |
| # check that your best 60 credits from third level is as good as weighted-credit class. | |
| def qa(data): | |
| distincts = [x for x in data if x[2] == "Distinction" and x[3] == 3] | |
| return sum([x[1] for x in distincts]) >= 60 | |
| class CreditThreshold(Enum): | |
| FIRST_THRESHOLD = 630 | |
| UPPER_SECOND_THRESHOLD = 900 | |
| LOWER_SECOND_THRESHOLD = 1170 | |
| THIRD_THRESHOLD = 1440 | |
| is_first(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment