DEV Community

Cover image for Codecademy Final Project: Flower Data Search
lila.code
lila.code

Posted on

Codecademy Final Project: Flower Data Search

The final project for Codecademy's data structures and algorithms course in computer science is to make recommendation software. I chose flowers as my topic and types based on flower name, color, life cycle, and season as the categories the user can search for. The flower data includes these categories for every flower and I stored the flower data in a binary search tree using keys of the flower types that apply to every flower.

Python Code

The program is written in VS Code and split into six files: the tree node and binary search tree class files, the flower data and flower data BST files, the main program file, and a title image file.

The flower data BST file builds a binary search tree from the flower data file's flower type keys and data list values and the main program file runs the flower data search through five functions. The get_list_values() function and merge_sort() algorithm implement an autocomplete based on the beginning of a word and output flower types the user can search for.

If the user picks a flower type other than flower name (color, life cycle, season, or pet safe), the user_choice() function will ask about the other categories to filter their results and if the user picks a flower name, there will only be one data entry to search for.

The final flower_data_search() function asks for the beginning of a word, calls the functions that retrieve and sort flower types, asks for a flower type search word, calls user_choice() if necessary, and prints the flower data through the BST's get method. The user can search multiple times and exit the search at one of the exit questions.

See code on GitHub

Top comments (0)