-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhard.py
More file actions
50 lines (33 loc) · 1.61 KB
/
Copy pathhard.py
File metadata and controls
50 lines (33 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Inside conditions.json, you will see a subset of UNSW courses mapped to their
corresponding text conditions. We have slightly modified the text conditions
to make them simpler compared to their original versions.
Your task is to complete the is_unlocked function which helps students determine
if their course can be taken or not.
We will run our hidden tests on your submission and look at your success rate.
We will only test for courses inside conditions.json. We will also look over the
code by eye.
NOTE: This challenge is EXTREMELY hard and we are not expecting anyone to pass all
our tests. In fact, we are not expecting many people to even attempt this.
For complete transparency, this is worth more than the easy challenge.
A good solution is favourable but does not guarantee a spot in Projects because
we will also consider many other criteria.
"""
import json
# NOTE: DO NOT EDIT conditions.json
with open("./conditions.json") as f:
CONDITIONS = json.load(f)
f.close()
def is_unlocked(courses_list, target_course):
"""Given a list of course codes a student has taken, return true if the target_course
can be unlocked by them.
You do not have to do any error checking on the inputs and can assume that
the target_course always exists inside conditions.json
You can assume all courses are worth 6 units of credit
"""
for thing in CONDITIONS:
if "units of credit" in CONDITIONS[thing]:
CONDITIONS[thing] = CONDITIONS[thing].replace("units of credit", "UoC")
print("Got filtered, sorry.")
# TODO: COMPLETE THIS FUNCTION!!!
return True