[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 371 KB, 500x375, 1373140874408.gif [View same] [iqdb] [saucenao] [google]
7560989 No.7560989 [Reply] [Original]

I'm writing a schedule optimizer in python. I have a list of courses (let's say 5 for example) and each course is an object with 3 attributes, each of which corresponding to a list of the lectures, tutorials, and labs, respectively. I need to check every lecture/tutorial/lab combination for each course with every lecture/tutorial/lab combination for each of the other courses.

The problem I'm running into is structuring a bunch of nested for loops to take care of this. If a course has no tutorials or no labs for example, the nested for loops would need to double in size. That is, I would need an if statement which checks for any tutorials/labs for each of those and nests for loops accordingly. I have no idea how to organize this search for all the combinations. Any help would be great.