Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Python Illustrated

You're reading from   Python Illustrated Not another boring Python book, learn programming the fun way

Arrow left icon
Product type Paperback
Published in Feb 2026
Publisher Packt
ISBN-13 9781836646334
Length 432 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Maaike van Putten Maaike van Putten
Author Profile Icon Maaike van Putten
Maaike van Putten
Imke van Putten Imke van Putten
Author Profile Icon Imke van Putten
Imke van Putten
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Introduction
2. Get Your Computer Ready to Code Python FREE CHAPTER 3. Understanding Variables and Data Types 4. Working with Conditional Statements 5. Using Lists, Tuples, and Dictionaries 6. Iterating with Loops 7. Writing Functions and Using Built-In Functions 8. Handling Files and Exceptions 9. Creating and Using Classes 10. Understanding Inheritance 11. Debugging Our Code 12. Next Steps 13. Unlock Your Exclusive Benefits 14. Other Books You May Enjoy
15. Index
Appendix A: Exercise Files 1. Appendix B: Quiz Answers 2. Appendix C: Exercise Solutions

Running your first Python program

In order to run our program, we’re going to need the terminal again. So, let’s open the terminal as a first step. We have an additional challenge before we can run it: we need to find the file. Let’s start by asking ourselves the question, where is the file saved? Let’s say that, on my laptop (macOS), it’s stored here:

/Users/zia/Documents/pythoncourse

The easiest way to go there is by entering the full (absolute) path in the terminal, like this:

cd /Users/zia/Documents/pythoncourse

Let’s make sure we’re in the correct folder by asking where we are:

pwd

If you want to see the files that are in there, you can run the dir command for Windows and the ls command for macOS and Linux.

Now that we’re in the correct location, we’ll run the program. We do this by typing the python command, this time not followed by --version, but by the name of the file. So please...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Python Illustrated
You have been reading a chapter from
Python Illustrated
Published in: Feb 2026
Publisher: Packt
ISBN-13: 9781836646334
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon