I'm having trouble with problem set 8. I have two pieces of code, one returns the a list with repeating instances, the other doesn't pull the best numbers, I've tried to memo both the hand out from lecture 13 or 14, and the brute force adviser from earlier in the problem set, http://dpaste.com/554284/ AND http://dpaste.com/554285/ if someone could tell me where I'm going wrong, I'd appreciate it
still looking, might take me a while.. but a couple of things: 1st post line 15 - why do you sort names? if you don't sort names then lines 16-18 can be accomplished with --- values = subjects.values(). the index relationships will be maintained... i asked this on the Python irc channel and everyone said yes see the note to the items method http://docs.python.org/library/stdtypes.html#dict.items your first post is very similar to what i did, but i only kept track of the indices in dpAdvisorHelper and returned those. your lines 46-59 look different than what i did 'at the end' can't tell yet. here's mine: http://dpaste.com/554444/
or here's the file with some builtin tests
I actually did the sort thing for debugging purposes, it was hard to keep track of things when i didn't know what index led to what values, also note for testing purposes my list of subjects is restricted to the 6.00-6.19 courses, 46-59 was necessary to record both value and indexes, I've included your branch_value() function and followed your idea of keeping only indecies, cleaned up my code a bit, and its running as i expect it but i haven't tested it thoroughly, but I get the answer I wanted with the full list at 30 work units. thank you so much for your help, I've been stuck for the better part of two weeks
this one also took me a long time and a lot of 'research'/reading. i've been looking at your original code (the first one) and comparing parts of it to mine but i cannot find where th problem is. if you can pinpoint the difference that was causing yours to behave incorrectly, i'd really like to know.
I haven't found why its acting differently, but something in the fact i was trying to record two pieces of information, the index list (or i think in my case the list of course names) and the value, it was just messing up, the memo didn't take it well, it kept repeating numbers leaving me with an index list at the end that was twice the size of the subject list and far exceeded the work value. either way i guess Occam s razor applies here, simpler is better