I Wrote a Python Programming Book in 6 Hours

Read this to learn how I built and used an AI Assistant to make it happen

Merry fetching Christmas builder!

Lots of gifts to give you today, let’s dive on in!

Yesterday at 4pm I finished my book on Python programming.

I had started it 6 hours earlier at 10:15am. Technically, I had taken a 30 minute break when ChatGPT capped my usage, then another one hour break to eat some food and play with my daughter (danced a bit, sang a bit, walked a bit). Still got it done.

Let’s fetching go.

Let’s rewind to 10am yesterday morning.

I was sleeping.

Fast forward 3 minutes.

It’s 10:03am. I wake up. There’s a fire in my belly to make this Saturday count.

I’m determined to make progress on my dreams and enter the Christmas season satisfied and fully present with my family.

How could I do that?

An idea that had been simmering in the back of my mind finally came to the forefront: writing a book on Python programming.

I've been approached dozens of times by people eager to learn Python, and I knew that a book could be an ideal starting point for them. Additionally, I already had a structured process for teaching programming tucked away in my beautiful second brain (I’ve been noodling on it for 3 years).

Lastly, this book wasn't just for my aspiring programmer audience.

It is also a crucial example in a product I'm developing called PlayBook, which is designed to transform books into immersive experiences.

The timing was serendipitous as well.

Just this past week, three different individuals had inquired about the process of writing books with AI. By 10:15am, my intention was crystal clear. I needed a book that could integrate seamlessly into PlayBook and a replicable process I could share with others on how to author books using AI.

Choosing a non-story-heavy book on teaching Python programming was the perfect starting point.

It aligned with my teaching goals, fit into the PlayBook model, and provided an excellent case study for AI-assisted writing.

So I began.

The Genesis of ‘Book Writing Assistant’

First off, what a dumb name. But I wasn’t after the aesthetics or anything cool.

I just told the GPT Creator I wanted a GPT that could make me books.

That’s the name it chose.

So we are going with it.

For those who don’t know, GPT is what OpenAI (the creator of ChatGPT) calls their AI Assistants: GPTs. I’ll be using this newly christened word from here on out.

Diving into my second brain, I also had a note called “Writing a Book.”

Here is what was written in it:

  1. Create a Working Title

  2. Create an Outline by Naming Each Chapter

  3. Create the Subheads for Each Chapter

  4. Fill in Each Subhead

  5. Revise

Simple. Straightforward. Perfect.

These steps served as the ideal blueprint for my GPT.

Designing the GPT to handle the initial steps of creating a working title and chapter outlines was straightforward. The real challenge lay in managing the wealth of information that steps 3, 4, and 5 involved. This is where the baby step solutions came into play.

Here’s a breakdown of what I asked it to do for step 3, 4, and 5:

  • Creating Subheads: Done chapter by chapter, with a pause for approval before moving on.

  • Filling Out Subheads: Each subhead was expanded one at a time, with progression contingent on my approval.

  • Revisions: This occurred in real-time, allowing me to tackle issues as they arose, maintaining the quality and coherence of each chapter.

This methodical, baby-step approach not only made the writing process manageable (no overwhelm) but also ensured that each section of the book received attention and refinement.

With the GPT’s instructions given, I was ready to write!

The Step by Step

Here are the steps I went through to build my book in 6 hours:

  1. Setting the Intention: I started by feeding the GPT my core intention: to write a Python book that introduced foundational principles for reading code. I copied much of what I wanted to teach from my notes on programming. My teaching structure was simple: learn the vocabulary, apply it in reading code, and usually, write code (though the “writing” was omitted for this book as you can’t write code in a normal book, but you can in a PlayBook!).

  2. Choosing a Title: The GPT instantly made 5 titles for me. I chose number 5.

  3. Building and Revising the Outline: The GPT then crafted an initial outline for the book. After a few revisions, we had a solid structure in place. The picture doesn’t show the complete outline, but it provides the gist I think.

  4. Creating (Sub)Subheads: Working chapter by chapter, the GPT developed (sub)subheads for each section (since it had already technically made subheads). Most of this was me reading things and saying “yeah that looks perfect let’s move on.”

  5. Expanding Each Section: Then I used AI to expand each subhead of the book, chapter by chapter. The first chapter took the most time because I knew that if I got it right the first time, every other chapter would just flow. AI is incredibly good at following patterns. To that end the first chapter underwent multiple iterations, including adding terms for a glossary, refining instructions, and removing irrelevant sections (like the “write” section).

  6. Formatting and Polishing: Each completed chapter was copied into a software like Medium to strip away the ugly highlighting on the text (remove unwanted text colors). Then it was copied into my google doc. This step was crucial for preserving the aesthetic quality of the book, and minimizing my own time spent formatting the text.

  7. Rinse and Repeat: Steps 5 and 6 were replicated for each chapter, with the GPT generating content and me making revisions or polishing as needed.

  8. Final Touches: The book concluded with the GPT creating an introduction, compiling a glossary of key terms, and writing a wrap-up (Celebratory messages were programmed as a fun conclusion, because you know, why not).

Version 1 of the book is done and it was pretty fun!

And it was all done in less than 6 hours.

You can check it out here by clicking the nice button below:

Lessons Learned and Some Caveats

The Caveats

  1. Programming is well known by the AI, and it can help me make decisions since it is aware of how it all works. Writing a book like this would be much more difficult if I was writing on an obscure topic or if it was more creative in nature (though not impossible).

  2. I have a massive amount of experience writing code (16 years) and a background in teaching people how to write code (5 years). Without this knowledge, this would have been much harder. I would recommend writing on the things you know about.

The Lessons

  1. First Chapter is Key: Spend the time perfecting the first chapter. Work with the AI to establish a style and structure that resonates with you. Once this is nailed down, you have a template that the AI will follow for the rest of the book, making the writing process smoother and more consistent. I asked it to rewrite the first chapter at 4 times, along with multiple personal revisions that I fed back into it.

  2. Iterative Rewriting: Don't hesitate to ask the AI to rewrite sections multiple times. Keep providing context until it aligns perfectly with your vision and voice. This iterative process ensures the content actually reflects your style and meets your standards.

  3. Leverage Your Resources: Having a repository of your own work or notes to feed the AI can be incredibly beneficial. It gives the AI the material to emulate your voice and style more accurately, resulting in a book that sounds authentically like you, and uses your own systems to teach!

The Future of Writing with AI

I don’t believe that AI will ever replace the experiences of humans.

But I do believe that those who write with AI will outpace those who don’t.

My experience today drives this home for me.

I was able to spend the majority of my time thinking.

The AI was the executor of my thoughts.

And now I have:

  1. A book I can share with people who want to learn to program!

  2. A process for writing a self help book, that can be extended to other kinds of books!

  3. An example I can plug into my PlayBook platform!

Life is so exciting =D

If you’d like to use my GPT to write your own book, click the button below to test it out! (This requires ChatGPT Pro)

These are my gifts to you. Merry Christmas friend!

AI coach,
Sterling Long!

P.S. If you’d like to learn how to do things like this (write a book in 6 hours), join my cohort of Builders who will be kicking off their New Year with 4 weeks of AI Group Coaching. Its 50% off until New Years! Click the button below to check it out!