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, I'd highly recommend my comprehensive curated list on Python to get started.

Motivation and FAQ

I've been conducting a few Python introduction workshops for college students and faculty since 2016. These students were already familiar with another programming languages such as C, Java, etc. I used to provide my notes in PDF format as a workshop reference material, further reading resources, etc. After I started writing a book titled Practice Python Projects, I realized I'd be better served by improving my Python knowledge first. What better way to do it than writing a book?

Why is it called 100 Page Python Intro when it has more than 100 pages?

There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors — Leon Bambrick

The material I was using for my workshops was 56 pages. I had more chapters to add, but I thought it would be a struggle to reach 100 pages, instead of overshooting the goal in the end. The measurement also depends on a few factors. The main content will be less than 100 pages if I reduce the font size from 12 to 11, exclude cover, TOC, Preface, etc.

Conventions

  • The examples presented here have been tested with Python version 3.9.5 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 on those topics 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.

Acknowledgements

Feedback and Errata

I would highly appreciate if you'd let me know how you felt about this book, it would help to improve this book as well as my future attempts. Also, please do let me know if you spot any error or typo.

Issue Manager: https://github.com/learnbyexample/100_page_python_intro/issues

E-mail: learnbyexample.net@gmail.com

Twitter: https://twitter.com/learn_byexample

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

Images mentioned in Acknowledgements section above are available under original licenses.

Book version

1.2

See Version_changes.md to track changes across book versions.