Graphing My Way Through the Library

Day 52 of 100 Days Coding Challenge: Python

You know you’ve reached a new level of coding attachment when you start treating your genre list like a prized bonsai tree—snipping here, trimming there, fussing over every little branch of logic. After revamping the program so it could accept new genres and pretty colors via a palette (very fancy, I know), I realized there was no graceful way to unmake a genre. What if I added “Historicl Fiction” by mistake? What if I picked a color so hideous that even my pie chart looked like it wanted to gag?
Today was all about giving myself the power to fix those flubs. Rename it, delete it, clean up my genre garden—snip snip! Because frankly, if I don’t like the color, the genre might just have to go.

Today’s Motivation / Challenge

Every great coder hits that moment where they scream at the screen, “Why can I add but not delete?!” It’s like buying furniture without knowing how to return it. I wanted my program to feel flexible, like a well-organized closet—not a hoarder’s storage unit of genre typos and duplicate categories. And let’s be honest, sometimes “Fantasy” and “Science Fiction” are just playing dress-up in each other’s clothes. Merge, rename, delete, repeat.

Purpose of the Code (Object)

This update lets users do a little genre housekeeping. You can now clean up your list by renaming genres (in case of typos or re-categorizing) or deleting them completely. It helps keep your visualizations tidy and your data organized—without diving into the JSON file manually. Think of it like giving your genre system a tiny admin panel without the drama.

AI Prompt:


Add a feature to let users rename or delete genres from the saved genre-color dictionary and persist it using JSON.

Functions & Features

Add a new genre and assign it a color using a color picker
Save all genres and colors to a JSON file automatically
Rename existing genres in case of typos or reclassification
Delete genres that are no longer wanted
Keep your pie charts and reports squeaky clean

Requirements / Setup

Install required library: pip install matplotlib pandas
Python 3.9 or later recommended for date handling and plotting.
No external JSON library needed—just the built-in json and os modules
tkinter (comes with Python standard library)

Minimal Code Sample

def rename_or_delete_genre(genre_color_dict):
print(“\nCurrent Genres:”)
for genre in genre_color_dict:
print(f”- {genre}”)

choice = input("\nRename or Delete? (r/d): ").strip().lower()
if choice == 'r':
    old = input("Old genre name: ")
    new = input("New genre name: ")
    if old in genre_color_dict:
        genre_color_dict[new] = genre_color_dict.pop(old)
        print(f"Renamed '{old}' to '{new}'.")
    else:
        print("Genre not found.")
elif choice == 'd':
    target = input("Genre to delete: ")
    if target in genre_color_dict:
        del genre_color_dict[target]
        print(f"Deleted '{target}'.")
    else:
        print("Genre not found.")
save_genre_colors(genre_color_dict)

This snippet shows how to let users clean up the genre-color dictionary and save the changes.

Book Tracker

Notes / Lessons Learned

This might sound like a small tweak, but it was a surgical upgrade. I tested, tweaked, and made backup copies like I was preparing to launch a space probe, not a genre menu. And wow—what a difference it made. Now if I want to merge “Thriller” into “Mystery,” I don’t need to panic about breaking anything.
It also got me thinking about naming in general. Genres are a bit like moods—they shift. So it helps to keep things tidy and editable. Pro tip? Rename before deleting, just in case you regret it five seconds later.
Also, I’m now officially annoyed that my function menu jumps from 7 to 11. Time to refactor. Naming may be hard, but numbering is… even harder?

Optional Ideas for Expansion

  • Add a feature to merge two genres into one, including updating past entries
  • Include a log file that records changes to genres for version control
  • Let users reorder the genre list manually so the menu stays tidy and satisfying

A Little Genre Surgery: Rename, Remove, Repeat

Day 51 of 100 Days Coding Challenge: Python

You know you’ve reached a new level of coding attachment when you start treating your genre list like a prized bonsai tree—snipping here, trimming there, fussing over every little branch of logic. After revamping the program so it could accept new genres and pretty colors via a palette (very fancy, I know), I realized there was no graceful way to unmake a genre. What if I added “Historicl Fiction” by mistake? What if I picked a color so hideous that even my pie chart looked like it wanted to gag?

Today was all about giving myself the power to fix those flubs. Rename it, delete it, clean up my genre garden—snip snip! Because frankly, if I don’t like the color, the genre might just have to go.

Today’s Motivation / Challenge

Every great coder hits that moment where they scream at the screen, “Why can I add but not delete?!” It’s like buying furniture without knowing how to return it. I wanted my program to feel flexible, like a well-organized closet—not a hoarder’s storage unit of genre typos and duplicate categories. And let’s be honest, sometimes “Fantasy” and “Science Fiction” are just playing dress-up in each other’s clothes. Merge, rename, delete, repeat.

Purpose of the Code (Object)

This update lets users do a little genre housekeeping. You can now clean up your list by renaming genres (in case of typos or re-categorizing) or deleting them completely. It helps keep your visualizations tidy and your data organized—without diving into the JSON file manually. Think of it like giving your genre system a tiny admin panel without the drama.

AI Prompt:

“Add a feature to let users rename or delete genres from the saved genre-color dictionary and persist it using JSON.”

Functions & Features

  • Add a new genre and assign it a color using a color picker
  • Save all genres and colors to a JSON file automatically
  • Rename existing genres in case of typos or reclassification
  • Delete genres that are no longer wanted
  • Keep your pie charts and reports squeaky clean

Requirements / Setup

pip install matplotlib pandas

(Also includes built-in modules like json and os, so no sweat there.)

Minimal Code Sample

def rename_or_delete_genre(genre_color_dict):

    print(“\nCurrent Genres:”)

    for genre in genre_color_dict:

        print(f”- {genre}”)

    choice = input(“\nRename or Delete? (r/d): “).strip().lower()

    if choice == ‘r’:

        old = input(“Old genre name: “)

        new = input(“New genre name: “)

        if old in genre_color_dict:

            genre_color_dict[new] = genre_color_dict.pop(old)

            print(f”Renamed ‘{old}’ to ‘{new}’.”)

        else:

            print(“Genre not found.”)

    elif choice == ‘d’:

        target = input(“Genre to delete: “)

        if target in genre_color_dict:

            del genre_color_dict[target]

            print(f”Deleted ‘{target}’.”)

        else:

            print(“Genre not found.”)

    save_genre_colors(genre_color_dict)

This snippet shows how to let users clean up the genre-color dictionary and save the changes.

Book Tracker

Notes / Lessons Learned

This might sound like a small tweak, but it was a surgical upgrade. I tested, tweaked, and made backup copies like I was preparing to launch a space probe, not a genre menu. And wow—what a difference it made. Now if I want to merge “Thriller” into “Mystery,” I don’t need to panic about breaking anything.

It also got me thinking about naming in general. Genres are a bit like moods—they shift. So it helps to keep things tidy and editable. Pro tip? Rename before deleting, just in case you regret it five seconds later.

Also, I’m now officially annoyed that my function menu jumps from 7 to 11. Time to refactor. Naming may be hard, but numbering is… even harder?

Optional Ideas for Expansion

  • Add a feature to merge two genres into one, including updating past entries
  • Include a log file that records changes to genres for version control
  • Let users reorder the genre list manually so the menu stays tidy and satisfying

Fifty Shades of Hue: Letting the User Pick the Palette

Day 50 of 100 Days Coding Challenge: Python

Some people know the names of colors the way sommeliers know wines—by region, undertone, and emotional baggage. I am not one of those people. The other day, I misspelled a color name while trying to assign it to a new genre. I expected a big angry error message. Instead? Python shrugged and picked something. It was a shade, I suppose, but not the one I had in mind. That’s when I realized: if I’m going to survive this genre-color dance, I need more than luck. I need a color picker.

So today’s upgrade is all about seeing what you’re getting. No more guessing if “slateblue” is dusty or deep, no more typing out names like “lightgoldenrodyellow” with trembling fingers. Now I just click, pick, and go. Call it coding for the colorblindly optimistic.

Today’s Motivation / Challenge

Because naming colors from memory is a trap. Unless you moonlight as a paint chip designer at Benjamin Moore, chances are you don’t know your cornflower from your cadet blue. Adding a visual color picker turns the guessing game into a satisfying click-and-smile experience. Think of it as your genre’s fashion stylist—choosing just the right outfit without you typing the wrong thing.

Purpose of the Code (Object)

This project adds a GUI color picker to the genre customization tool. Now, when you want to assign a new color to a genre, a little window pops up and lets you see your options—no spelling errors, no surprises. Once you choose your color, the code saves it so your pie charts remain stylish and sensible across runs.

AI Prompt:

Create a visual color picker for assigning genre colors in a book tracking program using tkinter. Make sure the selection is saved and reused.

Functions & Features

  • Add new genres with customized colors
  • Pick colors visually using a color palette window
  • Automatically save selected colors to a persistent JSON file
  • Load colors each time the program starts—no hardcoding needed
  • Keeps your genre pie charts looking consistent and fabulous

Requirements / Setup

 Built-in modules only—no pip installs needed!
Just make sure you’re using:

  • Python 3.x
  • tkinter (comes with Python standard library)

Minimal Code Sample

def choose_color_gui():

    import tkinter as tk

    from tkinter import colorchooser

    root = tk.Tk()

    root.withdraw()

    return colorchooser.askcolor(title=”Choose a Color”)[1]

This little window lets you visually pick a HEX color without typing anything.

Book Tracker

Notes / Lessons Learned

Adding a color picker was smoother than expected—until I realized the pop-up window was hiding behind my active screen. Cue two minutes of wondering if the code was broken, followed by an “aha!” moment on screen two. Also, as always, I backed up my program first. Rule #1 of coding anything visual: back up, test, and be ready for the ghost windows that pop up in the digital shadows. But once I found it, the tool worked beautifully. For someone like me—who thinks in color families, not exact swatches—this is a game changer.

Optional Ideas for Expansion

  • Add a “preview pie chart” before saving the color to test how it looks
  • Suggest complementary or contrasting colors based on your selection
  • Group similar genres with similar shades for aesthetic cohesion

The Case of the Missing Genre: Solved by JSON

Day 49 of 100 Days Coding Challenge: Python

One day, you’re happily adding a shiny new genre—Mystery—and the next day it’s gone, vanished like a plot twist in an Agatha Christie novel. No “goodbye,” no note, not even a hint of suspense music. I had proudly added a function yesterday to introduce new genres and assign them pretty colors. But today? That color-coded Mystery entry was MIA.

It turns out I was adding it, but… nowhere permanent. The program was as forgetful as I am without caffeine. So, I rolled up my digital sleeves and decided it was time to get serious. Enter: the humble JSON file. My mission? To build a system where genres and their colors stick around—even after the script shuts down. This also meant rewriting a lot of the functions that were still clinging to the old hardcoded dictionary, like it was a safety blanket. It was a minor genre revolution.

Today’s Motivation / Challenge

Why bother with persistent data? Well, imagine creating something you’re proud of—then watching it vanish the next time you open the program. Frustrating, right? This project reminded me of learning to save Word documents the first time you write them. This was about teaching my Python script to remember what I told it… like a well-trained assistant, not a goldfish.

Purpose of the Code (Object)

This update allows the program to permanently remember newly added genres and their colors. Instead of living only in memory (and disappearing the moment you close your terminal), your genres are now safely stored in a JSON file—ready to return every time you open the app. It’s like giving your code a diary… and making sure it actually writes in it.

AI Prompt

Able to save newly added genres and their colors.

Functions & Features

  • Load genre-color pairs from a JSON file at startup
  • Add new genres with custom colors on the fly
  • Automatically save those updates so nothing gets lost
  • Replaces hardcoded dictionaries with dynamic loading

Requirements / Setup

  • Python 3.6+
  • pandas, matplotlib
  • No external JSON library needed—just the built-in json and os modules

Install if needed:

pip install pandas matplotlib

Minimal Code Sample

import json

import os

GENRE_FILE = “genre_colors.json”

def load_genre_colors():

    if os.path.exists(GENRE_FILE):

        with open(GENRE_FILE, ‘r’) as f:

            return json.load(f)

    return {

        “Fiction”: “gray”,

        “Fantasy”: “purple”

    }

def save_genre_colors(genre_color_dict):

    with open(GENRE_FILE, ‘w’) as f:

        json.dump(genre_color_dict, f, indent=4)

# Use these to load and update your color map

genre_color_dict = load_genre_colors()

This snippet loads and saves your genre-color dictionary using a JSON file instead of hardcoded values.

Book Tracker

Notes / Lessons Learned

This was actually a significant overhaul of the existing programming. I was so nervous I triple-checked every line and even cloned my file before making changes—just in case things went full chaos mode. First, I had to import json and os, then create a file path for my new JSON genre diary. Next, I rewired the loading function to pull from this file, and rewrote add_new_genre_color() to actually save the additions (not just pretend).

Then came the big cleanup: my program was still using GENRE_COLORS all over the place like it was 2022. Every instance had to be swapped with genre_color_dict to work with my new system. That part? Not glamorous. But when I ran the script and everything held together—and Mystery stayed put—it felt like winning a game of digital Clue.

Optional Ideas for Expansion

  • Add a user input menu to pick a color visually from a palette (instead of typing ‘slateblue’)
  • Add a “reset to default” feature if your JSON file ever gets out of hand
  • Include tooltips in the visualization showing genre + average page counts

Adding a Splash of Genre Flair

Day 48 of 100 Days Coding Challenge: Python

After days of tinkering with this book tracker like a mad librarian with a barcode scanner, I realized something important: I don’t want to be the poor soul manually updating the genre-color dictionary every time I read something new. Let’s face it—“User-friendly” doesn’t mean much when the only user is me, and I still find myself muttering, “Why isn’t this thing purple?” every time I forget to update the genre list.

So today’s quest? Build a feature that lets me add new genres and assign them pretty little colors on the fly—without breaking the whole program or sending myself into a debugging spiral. It’s not just about aesthetics. It’s about freedom. Genre freedom. Color-coded, quarter-sorted, reader-powered freedom.

Today’s Motivation / Challenge

Sometimes, your biggest obstacle is your past self—the one who hardcoded things thinking they’d never change. Past Me didn’t expect Present Me to branch out from Fantasy and Sci-Fi. But here we are, reading historical dramas and the occasional poem. Rather than letting my program judge me for my evolving tastes, I figured it was time to teach it some manners. Today’s challenge was about flexibility: giving my tracker the power to grow as my reading list does.

Purpose of the Code (Object)

This update makes the book tracker more interactive and adaptable. Instead of manually editing the genre-color dictionary every time I pick up a new type of book, I can now add a new genre and assign it a color from within the program itself. It’s one small line of code for me, one giant leap for my sanity.

AI Prompt:

“Add a function that allows the user to update the genre-color dictionary during runtime without editing the code directly.”

Functions & Features

  • Add and assign a new genre with a custom color
  • Auto-updated pie and bar charts include the new genre
  • Prevents duplicate genres by checking existing entries
  • Keeps your genre list as fresh as your reading habits

Requirements / Setup

You’ll need:

pip install matplotlib pandas

Python 3.8+ is recommended, but it should work on most modern versions.

Minimal Code Sample

def add_new_genre_color(genre_color_dict, new_genre, new_color):

    if new_genre in genre_color_dict:

        print(f”{new_genre} already exists with color {genre_color_dict[new_genre]}.”)

    else:

        genre_color_dict[new_genre] = new_color

        print(f”Added new genre: {new_genre} with color {new_color}.”)

This simple function updates the dictionary in real time, without opening the script file.

Book Tracker

Notes / Lessons Learned

One of the biggest challenges I’m facing now is the trail of code left behind by my earlier, less organized self. Back then, I hardcoded colors like a kid with a new box of crayons and zero aesthetic restraint. The result? A genre list that doesn’t always match my pie chart, or my mood.

Today, I tested the new feature by adding “Mystery” as a genre. I even fabricated a “Mystery Book” just to make sure it worked. Spoiler: it did. And yes, it showed up beautifully in the pie chart too. Eventually, I might scrap the rigid GENRE_COLORS dictionary altogether and switch to a fully dynamic model—one that builds as I read. One genre at a time.

Optional Ideas for Expansion

  • Save updated genres and colors to a JSON file so they persist after the script closes
  • Add a feature to suggest random colors if the user can’t pick one
  • Let users rename or delete genres via a menu option

Quarterly Exhaustion: Which Genres Drain Your Brain?

Day 47 of 100 Days Coding Challenge: Python

I read for all kinds of reasons—personal growth, research, curiosity, or just to escape reality for a few hundred pages. And because of that, my bookshelf looks like it belongs to someone with multiple personalities. I’ve always known that I gravitate toward science fiction and fantasy (Stormlight Archive, anyone?), but lately I’ve had a sneaking suspicion: fantasy books might secretly be way longer than anything else.

So today, I decided to test that theory by adding a feature to calculate the average number of pages per genre per quarter. If fantasy is the literary equivalent of leg day, I want to know. And if I’m dragging by the end of Q3, it’s probably Brandon Sanderson’s fault.

Today’s Motivation / Challenge

You know that feeling when you finish a 900-page fantasy tome and think, “Why am I so tired?” Well, data can tell you why. Today’s challenge was to turn that vague feeling into a measurable trend. Think of it like a quarterly report—but instead of sales revenue, we’re analyzing book-induced fatigue.

Purpose of the Code (Object)

This code analyzes your reading log and breaks down the average number of pages you’ve read per genre, grouped by quarter. It helps you discover seasonal trends in your reading habits—like whether you go hard on historical fiction in spring or slow-burn through sci-fi during winter.

AI Prompt:

Add the function to calculate the average page count per Genre, grouped by quarter.

Functions & Features

  • Calculates average page count per genre, grouped by quarter
  • Displays the data in both printed table form and as a bar chart
  • Helps you discover which genres are “page-heavy” per season
  • Adds one more analytical layer to your personal book dashboard

Requirements / Setup

pip install pandas matplotlib

Minimal Code Sample

df[‘Quarter’] = df[‘Date Finished’].dt.to_period(‘Q’)

avg_pages = df.groupby([‘Quarter’, ‘Genre’])[‘Pages’].mean().unstack().fillna(0)

avg_pages.round(1).plot(kind=’bar’)

This snippet groups books by quarter and genre, calculates the average pages, and plots a bar chart.

Book Tracker

Notes / Lessons Learned

I’m officially over my fear of virtual environments—no more mysterious typos or wondering why the environment won’t activate. Adding this new function was pretty smooth. One thing I still find slightly annoying is juggling the menu options. Now that “exit” is option 7 and this new analysis is 8, my orderly brain twitches a little. But hey, renumbering is just cosmetic, right?

Honestly, the more I work on this program, the more I feel like it’s becoming mine. I’m not just learning Python anymore—I’m building something I actually want to use. That’s got to be the most rewarding part. Well, that and finally proving that fantasy books are absolute beasts.

Optional Ideas for Expansion

  • Let users filter by author to see who writes the longest tomes
  • Export the genre-per-quarter averages to a CSV file for archiving
  • Add a “reading fatigue index” based on total pages per week

Quarters, Colors, and the Gospel of Granular Reading Data

Day 46 of 100 Days Coding Challenge: Python

I’ve been tinkering with this book tracker for almost five days now, and let me tell you—things are starting to look serious. Not “move-in-together” serious, but close. As the code grows chunkier, I’ve been extra cautious about how I add each new function. Rather than throwing in five features and hoping nothing explodes, I take the accountant’s route: one entry at a time, reconciled and balanced.

Why the sudden urge to filter by quarter? Well, in the world of corporate accounting—where I live and breathe—we worship the fiscal calendar. Quarterly reporting is practically a sacrament. Automotive manufacturers slow down in summer and December, and trust me, so do I (with a good fantasy novel in hand). But that’s just a hunch. I wanted cold, clean, spreadsheet-worthy evidence that I read more Gothic tales as leaves fall and pumpkins rise. Gut feeling isn’t GAAP-approved. So today, we brought seasonal analysis into the Book Tracker universe.

Today’s Motivation / Challenge

Today’s challenge was simple but essential: how do you filter your data like a pro and still keep your chart options open? I wanted to analyze my reading habits by year and season, just like I do with budgets and forecasts. This time, instead of revenue trends, I’m tracking fantasy epics and Gothic drama. Same logic. Less coffee.

Purpose of the Code (Object)

This update adds the ability to view genre summaries filtered by year and, optionally, by quarter. The user can pick a year (and a quarter if they want) and choose between a pie chart or a bar chart to visualize what they’ve been reading. It’s like a financial report, but for books—and it’s way more colorful.

AI Prompt: 

“Add a menu option that lets the user filter the genre summary by year and quarter, and display the data in either a pie or bar chart based on their choice. Keep the code clean and beginner-friendly.”

Functions & Features

  • Lets users filter reading data by year and quarter
  • Visualizes genre distribution as either a pie chart or bar chart
  • Builds on existing color-coded genre system
  • Detects invalid input and guides the user gently (and politely)

Requirements / Setup

pip install pandas matplotlib

Python 3.9 or later recommended for date handling and plotting.

Minimal Code Sample

year = int(input(“Enter year to analyze: “).strip())

df = df[df[‘Date Finished’].dt.year == year]

quarter_input = input(“Enter quarter (1–4) or press Enter to skip: “).strip()

if quarter_input:

    df = df[df[‘Date Finished’].dt.quarter == int(quarter_input)]

This snippet filters your book log by the chosen year and optional quarter.

Book Tracker

Notes / Lessons Learned

The more I add features, the more I see the architecture underneath the code. This little book tracker has evolved into a proper app—with clearly separated layers: imports, genre definitions, graphing logic, and menu options. Honestly, that’s kind of magical. It’s like finally understanding how your espresso machine works after years of just pressing the button.

There’s a quiet thrill in building something you actually want to use. This wasn’t just another tutorial—I created a tool tailored to my reading life. And somewhere between bug-fixing and plotting pie charts, I realized: 46 days in, I’ve gone from curious coder to confident tinkerer. Not bad for someone who thought Python was just a snake when this all started.

Optional Ideas for Expansion

  • Add filters for author or language (in case you read in multiple languages)
  • Include average pages per genre per quarter to see which genres exhaust you
  • Export filtered results as a CSV report for sharing or archiving

Pie, Bar, and Book Nerd Bliss

Day 45 of 100 Days Coding Challenge: Python

I’m still tinkering with my book log program—not just because it’s part of my Python learning project, but because, let’s be honest, I want this thing to actually work. I mean, really work. As in “track-my-life’s-reading-habits-and-give-me-pretty-charts” work. Reading is sacred in my world, and keeping a log isn’t just a nerdy pastime—it’s a habit that brings me joy, perspective, and a little control over my chaos.

Today’s feature? I added a toggle so users (okay, me) can switch between a pie chart showing total genre distribution and a bar chart showing monthly genre patterns. Why? Because I read more Gothic and fantasy novels in October, and it’s satisfying to see that mood shift visualized. Also, toggles are cool. They make me feel like I’ve built a dashboard, not just a Python script.

Today’s Motivation / Challenge

Ever feel like you’ve built something, and it’s almost useful… but not quite delightful yet? That was me. So, today’s mission was simple: add a little UX sparkle. Let the user choose how to view their genre stats—like a buffet for data nerds. Pie or bar? Whichever suits the literary mood.

Purpose of the Code (Object)

This code adds a flexible summary feature to a book tracking app. It lets users choose between a pie chart showing the overall breakdown of genres they’ve read or a bar chart showing how many pages they read per genre by month. It’s a compact, practical way to visualize your reading habits—and yes, it’s way more fun than a spreadsheet.

AI Prompt:

“Add an option to toggle between a pie chart and a bar chart when viewing genre summaries in a Python book log app.”

Functions & Features

  • Add a book and track its genre, author, page count, and completion date
  • Import books from a CSV file
  • View a genre summary chart as either a pie or bar graph
  • Filter chart data by genre or month
  • See trends in pages read by month and genre

Requirements / Setup

pip install pandas matplotlib  

Minimal Code Sample

def show_genre_summary_chart():

    print(“Choose chart type:”)

    print(“1. Pie Chart (Overall Genre Distribution)”)

    print(“2. Bar Chart (Pages per Genre by Month)”)

    choice = input(“Enter 1 or 2: “).strip()

    if choice == “1”:

        plot_genre_pie_chart()

    elif choice == “2”:

        plot_progress()

    else:

        print(“Invalid choice.”)

This function lets the user decide how they want their genre stats served: sliced (pie) or stacked (bar).

Book Tracker

Notes / Lessons Learned

I’m getting much smoother with activating my virtual environment. Looking back, I can’t believe I fumbled so much with cd errors and typos just last week. Progress!

Today, even the smallest update required a little code renovation. First, I added a new function (show_genre_summary_chart) above the main() block. Then I gave the user a choice:

print(“Choose chart type:”)

print(“1. Pie Chart (Overall Genre Distribution)”)

print(“2. Bar Chart (Pages per Genre by Month)”)

Finally, I updated the main menu to replace the old genre graph option with this smarter version. It works like a charm.

Honestly, I’ve used so many apps over the years without fully appreciating what went into them. Now that I’ve written code that sort of behaves nicely, I’m grateful to all the developers who did this before the age of AI. I’ve got help, but they? They had raw logic, coffee, and probably a lot of bugs.

Optional Ideas for Expansion

  • Add a date filter for the pie chart (e.g., genre distribution by year or season)
  • Let users export the pie/bar charts as PNG files for their own book reports
  • Display top 3 most-read genres alongside the charts

Slicing Up Genres (With Pie, Not Precision Tools)

Day 44 of 100 Days Coding Challenge: Python

Yesterday’s mission? Make a colorful genre-based bar chart that didn’t look like a monochrome mess. After some wrestling with the code (and maybe whispering a few stern words to matplotlib), I decided to step back and take a wiser approach—add one function at a time. Think of it like seasoning a dish: too many spices at once and you can’t tell if the problem is the salt or the cinnamon.

So today, instead of fixing every chart in one go, I added something deliciously simple: a pie chart. Not the edible kind, unfortunately, but a visual feast for genre distribution. It’s a nice way to get a bird’s-eye view of what I’ve been reading—am I balanced, or living in a fantasy bubble? This project is starting to feel like a real book journal app, and that’s both exciting and mildly terrifying.

Today’s Motivation / Challenge


Histograms are great if you’re obsessed with dates (hi, it’s me), but sometimes you just want to know what you’ve been feeding your literary diet. A pie chart offers a big-picture summary of your reading preferences—like stepping back from the bookshelf and realizing 60% of it is purple dragon covers. Today’s goal? See the forest, not just the monthly genre trees.

Purpose of the Code (Object)


This updated code adds a neat little pie chart showing the proportion of each genre in your reading log. It uses the data already stored in your CSV file and the color settings from yesterday’s code. The result? A clean visual breakdown of your book habits, so you can brag about how “diverse” your library is—or realize it’s time to mix in something besides historical fiction.

AI Prompt:


Make it readable. Make it modular. And for the love of Python, add one feature at a time.

Functions & Features

  • Add books to a CSV file with metadata like title, author, pages, and genre
  • Show reading progress over time (bar chart by month and genre)
  • View genre-specific reading patterns
  • Display a pie chart of your overall genre distribution
  • Import book lists from another CSV file

Requirements / Setup

  • Python 3.x

Install the required library:

pip install matplotlib pandas

Minimal Code Sample

def plot_genre_distribution():

    df = pd.read_csv(FILE_NAME)

    df[‘Genre’] = df[‘Genre’].str.strip().str.title()

    genre_counts = df[‘Genre’].value_counts()

    colors = [GENRE_COLORS.get(g, ‘gray’) for g in genre_counts.index]

    plt.pie(genre_counts, labels=genre_counts.index, colors=colors, autopct=’%1.1f%%’)

    plt.title(‘Overall Genre Distribution’)

    plt.axis(‘equal’)

    plt.tight_layout()

    plt.show()

This function creates a genre pie chart based on the books you’ve read.

Book Tracker

Notes / Lessons Learned


What I added today was the code to create a pie chart, showing the distribution of genres. Then, I gave it a shiny new menu option. It worked surprisingly smoothly—probably because I didn’t try to fix five other things at the same time.

I’m finally getting used to virtual environments, which means fewer self-inflicted typos and wild goose chases through the wrong folders. The genre color dictionary I built yesterday made the pie chart almost too easy. That’s a nice surprise in coding: sometimes past-you actually set present-you up for success.

Also, here’s a bit of wisdom from building queries in SAP (and now in Python): change one thing at a time. If you break something, at least you know which line of code betrayed you.

Optional Ideas for Expansion

  • Let users toggle between the pie chart and the bar chart from the same menu
  • Allow subgenre tracking with drill-down options
  • Export the pie chart as an image to share or embed in a blog

Color Me Curious: Giving Genre Some Style

Day 43 of 100 Days Coding Challenge: Python

I kept tinkering with the tracker I built yesterday, chasing a dream—a dream of colors. Specifically, I wanted each book genre to appear in a different color in the graph from my Python book tracker genre visualization. That’s when I realized: my genre list was… how should I say it… ambitious. Turns out, tracking every tiny genre variation from “Science Memoir” to “Neo-Futurist Romance” makes the visualization look like a unicorn exploded on a bar chart.

To simplify, I added a new column for broader genres—less chaotic, more chart-friendly. My vision was to see a beautiful stacked histogram by genre color, but the code didn’t quite cooperate at first. It also made me realize something bigger: if I want this program to be truly useful, I’ll have to rethink how I track my books moving forward. Retroactively cleaning up all that old data? That’s a future-me problem. For now, this code is more about going forward than going backward.

Today’s Motivation / Challenge

If data is the new oil, then visualizing it is like turning that oil into fuel. Today’s challenge was about clarity—seeing reading habits at a glance. Colors help your brain grasp information faster, and genre-based colors are like putting your bookshelf on a rainbow diet. Also, it’s just more fun to look at.

Purpose of the Code (Object)

This program reads your book-tracking log and turns it into a visual chart, showing how many pages you’ve read each month. It highlights your genre diversity using color-coded bars, so you can instantly see if you’re stuck in a romance rut or finally diversifying your literary diet.

AI Prompt:

Add the existing Python code a color code for the following: Fantasy, Science Fiction….. History Fiction. 

Functions & Features

  • Add a new book to your reading log
  • Import books from another CSV file
  • List all books you’ve logged
  • Show a reading progress chart by month
  • Show a stacked genre-colored chart to compare reading trends

Requirements / Setup

You’ll need:

pip install pandas matplotlib

This code runs on Python 3.9+ (but most 3.x versions will do).

Minimal Code Sample

df[‘Genre’] = df[‘Genre’].str.strip().str.title()

df = df[df[‘Genre’].isin(GENRE_COLORS.keys())]

Standardize the genre format and filter out undefined genres so colors work correctly.

Book Tracker

Notes / Lessons Learned

Today, I had a brand new flavor of problem. You know the kind—where the code technically runs, but nothing happens? Turns out, I completely forgot to add:

if __name__ == “__main__”:

    main()

So the script just… stared at me, judging my oversight in silence. Classic rookie move.

But wait, there’s more. My bar chart decided that “colorful” meant “one color only.” Why? Because my genre strings were a mess—some had leading spaces, others were lowercase, and a few were practically jazz solos. After several rounds of trial and error (and a little sulking), I discovered this trick:

df[‘Genre’] = df[‘Genre’].str.strip().str.title()

instead of the other way around. And when I added this line to filter only the genres I’d actually assigned colors to:

df = df[df[‘Genre’].isin(GENRE_COLORS.keys())]

it finally worked. The chart bloomed into the colorful visualization I’d hoped for—like spring after debugging winter.

Optional Ideas for Expansion

  • Add a pie chart showing the overall genre distribution
  • Include a “favorite author” stat based on frequency
  • Let users define their own genre-color mappings in a config file