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
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.
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
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.
- 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.
- Offical Python website — documentation and examples
- stackoverflow and unix.stackexchange — for getting answers to pertinent questions on Python, Shell and programming in general
- /r/learnpython and /r/learnprogramming — helpful forum for beginners
- /r/Python/ — general Python discussion
- tex.stackexchange — for help on pandoc and
- Cover image:
- pngquant and svgcleaner for optimizing images
- Warning and Info icons by Amada44 under public domain
- Dean Clark and Elijah for catching a few typos
- mdBook — for web version of the book that you are currently reading
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.
Sundeep Agarwal is a freelance trainer, author and mentor. His previous experience includes working as a Design Engineer at Analog Devices for more than 5 years. You can find his other works, primarily focused on Linux command line, text processing, scripting languages and curated lists, at https://github.com/learnbyexample. He has also been a technical reviewer for Command Line Fundamentals book and video course published by Packt.
List of books: https://learnbyexample.github.io/books/
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.
See Version_changes.md to track changes across book versions.