Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 15 Online
OpenStudy (anonymous):

Stuck on PS8, Problem 2. Question is: Do you convert the subjects dictionary into a list before applying the optimization algorithms? If not, how do you find the subject name (the dictionary key), based on the (work, value) pair (the dictionary value)?

OpenStudy (anonymous):

[key for key, value in dictionary.iteritems() if value == (work, value)] should return a list of keys whose values meet the criteria. you get to decide whether to work with the dictionary or with lists. there are a number of ways to solve these. if you use dictionary methods to get lists of the keys and values, the order of the two lists are guaranteed to be maintained http://docs.python.org/library/stdtypes.html#dict.items

OpenStudy (anonymous):

If you decide to generate a list of subject keys, an easy way is: subject_list = subjects.keys()

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
3 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
3 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!