def mergeHSandColSeq(hs, cseq): mergedDict = {} indexNumb = 0 for student in hs.keys(): if student in cseq.keys(): indexNumb += 1 csunStudent = Student(student) csunStudent.squeezedID = indexNumb csunStudent.hsMath = hs[student].hsMath csunStudent.hsOldCNames = hs[student].hsOldCNames csunStudent.collegeSeq = cseq[student].collegeSeq mergedDict[student] = csunStudent return mergedDict
def read_a_sequence(line): line = line.strip() sid, placeholder, seq = line.partition("|") fields = seq.split("|") cInfoList = [] if len(fields) % 4 == 0: numbOfCourses = int(len(fields) / 4) for x in range(numbOfCourses): cInfo = [] cInfo.append(fields[(4 * x) + 0]) cInfo.append(fields[(4 * x) + 1]) cInfo.append(fields[(4 * x) + 2]) cInfo.append(fields[(4 * x) + 3]) cInfoList.append(cInfo) student = Student(sid) student.collegeSeq = cInfoList return student else: print("Malformed Course Sequence! Not enough fields.") return None