This commit is contained in:
SowinskiBraeden committed 2022-04-01 22:07:26 -07:00
1 parent 190daffced
commit de213b348a
7 files changed
+11730 -3032

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/python3
import json
import csv
realCourses = {}
# Get all courses from real sample data
def getSampleCourses(log=False):
with open("course_selection_data.csv", newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
exists = False
for course in realCourses:
exists = True if realCourses[course]["CrsNo"] == row["CrsNo"] else False
if exists: break
if not exists:
realCourses[row["CrsNo"]] = {
"CrsNo": row["CrsNo"],
"Requests": 0,
"Description": row["Description"],
"Credits": 4,
"Teachers": 3,
"students": []
}
if log:
with open("realCourses.json", "w") as outfile:
json.dump(realCourses, outfile, indent=2)
return realCourses
if __name__ == '__main__':
courseSet = getSampleCourses()
with open("realCourses.json", "w") as outfile:
json.dump(courseSet, outfile, indent=2)