Code Python, Consult AI: Python Fundamentals for the AI Era

Author

Michael Borck

Preface

Why This Book Exists

AI can write code. But it does not always write the right code. And if you cannot tell the difference, you have a problem.

This book teaches you enough Python to lead the AI, not follow it. It is not about becoming a full-time software engineer. It is about becoming AI-literate: understanding enough about how code works that you can spot errors, tweak outputs, give better prompts, and take control of your projects instead of relying on guesswork.

The fundamentals of programming have not changed because AI arrived. If anything, they matter more. The developers who get the most from AI tools are the ones who understand what the tools are producing. This book gives you that understanding.

Who This Book Is For

  • Beginners who want a focused introduction to Python fundamentals
  • Professionals who need to understand code well enough to work with AI tools effectively
  • Students preparing for courses or careers where Python and AI are standard tools
  • Anyone who tried Think Python, Direct AI and is ready for more depth on the language itself

You do not need prior programming experience, but some familiarity with programming concepts will help. If you are a complete beginner who has never thought about programming at all, start with Think Python, Direct AI — it builds the mental models this book assumes.

What This Book Is Not

This is not a computational thinking book. It does not spend time on problem decomposition or algorithmic reasoning — that is what Think Python, Direct AI covers. This book assumes you can think about a problem and focuses on giving you the Python to express the solution.

It is not a professional development practices book. It does not cover project structure, testing frameworks, dependency management, or deployment. That is what Ship Python, Orchestrate AI covers. This book focuses on the language.

It is not a reference manual. It covers the fundamentals you need to be productive, not every feature Python offers. When you need more, the official documentation and your AI assistant will fill the gaps — and you will be equipped to evaluate what they give you.

And it is not a book that treats AI as optional or dangerous. AI is woven throughout as a learning partner. The book teaches you to use AI to explore concepts, debug your code, and deepen your understanding — while always knowing enough to judge the output.

If You Are Feeling Uncertain

You are not behind. The landscape is shifting fast, and the feeling that everyone else already knows Python is nearly universal and rarely true. You do not need to master everything. You need to learn enough to be dangerous — in the good sense. Enough to read code, modify it, and know when AI is helping versus hallucinating. This book gets you there.

How This Book Is Structured

The book covers Python fundamentals in a logical progression:

  1. Core Fundamentals — values, variables, input, output, operators
  2. Functions and Control Flow — structuring your code, making decisions, loops
  3. Data Structures — lists, dictionaries, working with collections
  4. Working with Files — reading, writing, persistence
  5. Code Quality — debugging, testing, organising code
  6. Python in the AI Era — using AI assistants effectively, integrating AI into your work

Each chapter builds on the previous one, with interactive examples you can run directly.

The Series

This book is the second in a Python learning path:

  1. Think Python, Direct AI — computational thinking for absolute beginners
  2. Code Python, Consult AI (this book) — focused Python fundamentals
  3. Ship Python, Orchestrate AI — professional Python development practices and tooling

Start with Think Python, Direct AI if you are a complete beginner. Start here if you have some programming exposure and want to learn Python specifically. Move to Ship Python, Orchestrate AI when you are ready for professional workflows.

The methodology behind all three comes from Conversation, Not Delegation: How to Think With AI, Not Just Use It. All titles are available at books.borck.education.

Ways to Engage with This Book

This book is available in several formats. Pick whichever fits how you work and learn.

  • Read it online. The full book is freely available at the companion website, with dark mode, search, and navigation.
  • Read it on paper or e-reader. Available as a paperback and ebook through Amazon KDP.
  • Converse with it. The online edition includes a chatbot grounded in the book’s content.
  • Feed it to your own AI. The llm.txt file provides a clean text version of the entire book, ready to paste into ChatGPT, Claude, or any AI tool.
  • Run the code. All code examples are available on GitHub. DeepWiki provides an AI-navigable view of the repository.
  • Browse all books. This book is part of a series. See all titles at books.borck.education.

The online version is always the most current.

Source Code & Feedback

All code examples and supplementary materials are available at: https://github.com/michael-borck/code-python-consult-ai

Found an error? Have a suggestion?

  • Open an issue: https://github.com/michael-borck/code-python-consult-ai/issues
  • Email: michael@borck.me