DEV Community

ShaneFalero
ShaneFalero

Posted on

Second Python Project

https://github.com/ShaneFalero/Movie-recommendation-project.git

Greetings!
I am back again with the second required portfolio project that Codecademy asks its users in the computer science track. The project required the production of a recommendation service by manipulating data into one of the learned data structures from the most recent lectures (doubly-linked lists, graphs, hash-maps, heaps, queues, singly linked lists, stacks, and trees) and either sort the data structure or search through it using algorithms learned within the course (brute force algorithms, divide and conquer, greedy algorithms, dynamic programming, pathfinding, pattern search, sorting, and tree traversal algorithms).

Initially, I planned to develop a genre tree and traverse it based on subgenres listed within each Movie class. However, that file corrupted and I lost everything after 12 hours of work, so I opted to switch it up.

Walkthrough:
Movie-recommendation project
I created a hash-map of Movie classes with the 'Movie.title' attribute being the key to the hash-map to each value within the hash-map.
The Movie Class has a title, rating, cost, and subgenres for each movie. A list of the movie classes was created, iterated through and then automatically sorted through the hash-map. Open addressing was used for handling collisions.

In my functions file, there is a generic greeting (euphemism for Red Box within). Two inquiry functions were created as it was easier to recall for the primary logic function.

A logic_genre function was created by searching through a genre's list that was created containing every subgenre noted within the Movie classes. If the inquiry function output was within the list of genres, the movie list would be iterated through, and the user input would be compared with retrieval of the movie title from the hash-map (the subtitle would be pulled form this output). If the two were equal, then each movie would be retrieved and appended to another list and the list would be printed. The new list of movies would be returned.

Below, a second logic function was created. Within the logic_movie function, the newly created movie_list is iterated through and if the inquiry of the movie was equal to the title of the movie, then it would output print statements stating what the user is watching.
If the input was not equal to the movie titles within the list of movies BUT at least half of the letters within each string were equal, a pattern search function was developed to try to help alleviate any misspellings.

If more than half of the letters were misspelled, then the movie could not be found; the user would have to re-run the program.

There is a confirmation of whether the input was the correct movie, if yes then the program says its farewell and expresses gratitude.

Review:
Looking back at the development process of this program, there are a couple of things I would have changed:
I think the way I utilized the hash-map was incorrect or redundant. I could've just kept iterating through the list of movies made to create the hash-map (seems like a waste of time). I think when creating the hash-map in this case, maybe I should have considered separate chaining to a hash-map of genres as opposed to the titles of the movies being the keys.

I really like the pattern-search manipulation function that I implemented in this project, however, it does not handle when the number of letters inputted are different than the number of letters within the title of the movie. Adding some logic could be beneficial to further manipulate the user input and make it a more user-friendly program to help when user error is implemented.

Overall, I was not the biggest fan of this project to begin with, but I am glad I toughed it out and was able to troubleshoot the issues that I ran in to.

I look forward to any feedback I receive for creating this program. I appreciate any time people take to look at my program :)

Thanks,
Shane

Top comments (0)