www.cs.amherst/~ccm/cs111/prog4.html

Fourth Programming Assignment

This assignment is due by 5pm Wednesday December 11th. This is a hard deadline: Amherst College requires that all work due during the semester be turned in by the last day of classes, so as not to interfere with reading period.

Your assignment is to write a program to implement a recommender system like you find on Netflix or Amazon: ``people who liked that movie also enjoyed X.'' Your program makes use of two text files that I will provide, called books.txt and ratings.txt

What your program does

  1. Open the books.txt file and read the names and titles into an appropriate data structure.

  2. Open the ratings.txt file and reads the ratings data into an appropriate data structure.

  3. Offer the user a menu of options for how to use the data, including:

  4. The program should repeat the above process of printing a menu and inviting the user to choose an option (different user ids are allowed), continuing until the user is done. Invent a convenient way for the user to specify which action to take each time.

  5. Advice. This assignment is mostly about choosing appropriate data structures to hold the data. Your choices include strings, lists, tuples, dictionaries, and sets. There is not a perfect answer here, but your choice will affect how easy it is to accomplish certain tasks, so think carefully about the implications before you make your decision. It is perfectly reasonable to use more than one data structure to make the program easier to write.

  6. More advice. Proceed step-by-step and add one option at a time. You can get substantial partial credit if, say, just 4 of 5 options are offered, but they work perfectly. This is a better strategy than turning in a program that offers options that don't work right.

  7. More advice. Save a backup copy of books.txt and ratings.txt, in case your program accidentally messes them up while you are figuring out how to use Python for files.

Turning It In

  1. Name your file recommend.py.
  2. Make a trace file showing how the menu options work. Choose options in this order: