Preface

This book is a short, introductory guide for the Python programming language. This book is well suited:

  • As a reference material for Python beginner workshops
  • If you have prior experience with another programming language
  • If you want a complement resource after reading a Python basics book, watching a video course, etc

Prerequisites

You should be already familiar with basic programming concepts. If you are new to programming, check out my comprehensive curated list on Python to get started.

You are also expected to get comfortable with reading manuals, searching online, visiting external links provided for further reading, tinkering with the illustrated examples, asking for help when you are stuck and so on. In other words, be proactive and curious instead of just consuming the content passively.

Conventions

  • The examples presented here have been tested with Python version 3.13.0 and includes features that are not available in earlier versions.
  • Code snippets that are copy pasted from the Python REPL shell have been modified for presentation purposes. For example, comments to provide context and explanations, blank lines and shortened error messages to improve readability and so on.
  • A comment with filename will be shown as the first line for program files.
  • External links are provided for further exploration throughout the book. They have been chosen with care to provide more detailed resources as well as resources on related topics.
  • The 100_page_python_intro repo has all the programs and files presented in this book, organized by chapter for convenience.
  • Visit Exercises.md to view all the exercises from this book. To interactively practice these exercises, see my PythonExercises repo.

Acknowledgements

Feedback and Errata

I would highly appreciate it if you'd let me know how you felt about this book. It could be anything from a simple thank you, pointing out a typo, mistakes in code snippets, which aspects of the book worked for you (or didn't!) and so on. Reader feedback is essential and especially so for self-published authors.

You can reach me via:

Author info

Sundeep Agarwal is a lazy being who prefers to work just enough to support his modest lifestyle. He accumulated vast wealth working as a Design Engineer at Analog Devices and retired from the corporate world at the ripe age of twenty-eight. Unfortunately, he squandered his savings within a few years and had to scramble trying to earn a living. Against all odds, selling programming ebooks saved his lazy self from having to look for a job again. He can now afford all the fantasy ebooks he wants to read and spends unhealthy amount of time browsing the internet.

When the creative muse strikes, he can be found working on yet another programming ebook (which invariably ends up having at least one example with regular expressions). Researching materials for his ebooks and everyday social media usage drowned his bookmarks, so he maintains curated resource lists for sanity sake. He is thankful for free learning resources and open source tools. His own contributions can be found at https://github.com/learnbyexample.

List of books: https://learnbyexample.github.io/books/

License

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Code snippets are available under MIT License.

Resources mentioned in the Acknowledgements section above are available under original licenses.

Book version

2.0

See Version_changes.md to track changes across book versions.