[+] A2 P4 Q1

This commit is contained in:
Hykilpikonna
2021-10-03 15:05:16 -04:00
parent 8c81f79880
commit 83e0e0be5f
+9 -1
View File
@@ -50,7 +50,13 @@ def read_course_data(file: str) -> dict:
with open(file) as json_file:
data = json.load(json_file)
return data # TODO: transform data into the format specified in Part 4, then remove this TODO
return {raw['courseCode']: (raw['courseCode'], raw['courseTitle'],
[(section['sectionCode'], section['term'],
[(time['day'], datetime.time(int(time['startTime'].split(':')[0])),
datetime.time(int(time['endTime'].split(':')[0])))
for time in section['meetingTimes']])
for section in raw['sections']])
for raw in data.values()}
def transform_course_data(course_data: dict) -> tuple[str, str, set]:
@@ -140,6 +146,8 @@ if __name__ == '__main__':
import doctest
doctest.testmod()
print(read_course_data('data/course_data_small.json'))
# When you are ready to check your work with python_ta, uncomment the following lines.
# (Delete the "#" and space before each line.)
# IMPORTANT: keep this code indented inside the "if __name__ == '__main__'" block