def check_max_hours(plan, new_course): hours = get_classes_week(new_course) for course in plan: hours += get_classes_week(course) return hours <= max_hours
# completed_courses = ['EEL5105', 'INE5401', 'INE5402', 'INE5403', 'MTM5161', 'INE5404', 'INE5405','INE5406','INE5407','MTM5512','MTM7174','INE5408','INE5410','INE5411','MTM5245','INE5413','INE5414','INE5415','INE5416','INE5417','INE5419'] # plans = [] plans = build_plan(completed_courses) for i in range(len(plans)): semester = plans[i] hours = 0 string = str(i+1) + "º semestre:\n" for j in range(len(semester)): course = semester[j] # string += get_name(course) string += course if j < len(semester)-1: string += ", " hours += get_classes_week(course) string += "\n"+str(hours)+" horas/semana\n" print(string) # ta feio, ta rude def get_most_important_courses(): a = [] for b in courses: a.append(b) magnitudes = get_courses_magnitude(a) sort = sorted(magnitudes.keys(), key=lambda x: magnitudes[x])[::-1] rank = [] for item in sort: if item not in rank: rank.append(item)