Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(elective_human):
- elective_human = list(set(elective_human) - set(all_courses_tillnow))
- num_to_select = 1 # set the number to select here.
- list_of_random_items_human = random.sample(elective_human, num_to_select)
- CurrentSemester.extend(list_of_random_items_human)
- length = 0
- elective_pre = []
- tempElect = []
- temptempElect = []
- while(length < 2 and elective_course):
- elective_course = list(set(elective_course) - set(all_courses_tillnow)- set(tempElect))
- num_to_select = 2 - length # set the number to select here.
- list_of_random_items_human = random.sample(elective_course, num_to_select)
- elective_pre.extend(list(list_of_random_items_human))
- for row in elective_pre:
- pre = set(Prerequisite_Course.loc[Prerequisite_Course['Course'] == row]['Prerequisite'])
- condition = all(x in all_courses_tillnow for x in pre)
- if not pre:
- temptempElect.append(row)
- elif(condition):
- temptempElect.append(row)
- elif(not condition):
- pre =list(pre - set(all_courses_tillnow))
- temptempElect.extend(pre)
- temptempElect = (list(set(temptempElect)))
- for (j,row) in enumerate(temptempElect):
- if temptempElect[j] not in elective_course:
- temptempElect.remove(temptempElect[j])
- tempElect.extend(temptempElect)
- length=len(tempElect)
- elective_pre = []
- temptempElect = []
- elective_course = list(set(elective_course) - set(all_courses_tillnow)- set(tempElect))
- CurrentSemester.extend(tempElect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement