English subtitles

← When Offered Solution - Intro to Computer Science

Get Embed Code
3 Languages

Showing Revision 6 created 05/25/2016 by Udacity Robot.

  1. In this next question, we want to find all the hexamesters a given course is offered.
  2. So if we go back to our data structure, what we're going to do
  3. is go through each hexamester, each key in the highest level dictionary,
  4. search through all the keys of that dictionary.
  5. If they equal the course we're looking for, we're going to append it to a list of our results.
  6. The first thing I do is create the result list,
  7. and we're going to go through every key in courses to get each hexamester.
  8. If that course is in the dictionary for that hexamester,
  9. then we're going to append it to our offered list.
  10. And once we're finished, we're just going to return the list.