DEV Community

MozzarellaMonster
MozzarellaMonster

Posted on

Horror movie recommendation software

So, I've been working my way through Codecademy's Computer Science course and have just finished the portion about data structures and algorithms. To end this portion, I must complete a portfolio project using what I've learned to create a recommendation software.

The objectives of this project were:

  • Store data in a data structure
  • Use an algorithm to sort or search for data within a data structure
  • Use Git version control
  • Use the command line and file navigation
  • Write a technical blog post on the project

For this project, I decided to go with something I love: horror! I decided I would write a program that would recommend a horror movie based on tags chosen by the user.

Image description

I decided to use a MaxHeap data structure and heapsort algorithm to keep track of movies that satisfy the user's chosen tags. The movie data was stored in a dictionary with the movie name as the key and the corresponding tags in a list stored as the value. All the tags the user could choose from were also stored as strings in a list. I decided to use an altered implementation of the MaxHeap data structure and heapsort algorithm supplied by Codecademy to better suit the program's needs.

After using a while loop to get the user-supplied tags, I went and linked all the movies that satisfy those tags in a dictionary object, making sure to only include those movies that satisfy multiple user-selected tags.

I then changed that dictionary to a list of tuples with the name of the movie as the first index and the number of tags the movie satisfies as the second. After sorting through the list with a heapsort algorithm, I then returned the top three movies that satisfy the most tags to the user.

Image description

One problem I ran into was altering the heapsort algorithm and the MaxHeap data structure to suit my needs. Especially since there were no errors detected by my IDE, I needed to go back through and debug only to find out it was a logic error!

All in all, this was a fun project to work on and I learned a lot! Especially when it came to list comprehensions, which I did not know could also be used with a dictionary. I also worked with the .join() string method more than I ever had before in order to properly display all the lists and dictionaries I was using.

Surprisingly, the most time-consuming feature of this project was the creation of the movie data because I had to decide what kinds of tags to use and what would be most relevant to the user.

Go ahead and give it a try and see if there is anything that I could improve upon! Feedback is very appreciated!

Github: https://github.com/MozzarellaMonster/Recommendation-Software

Replit: https://replit.com/@MozzarellaMonst/Horror-Movie-Recommendation-Software?v=1

Top comments (0)