Learn Python by Doing Projects - Part 0: Getting Started for Absolute Beginners

Table of contents
- Who is this for?
- What you’ll learn today
- What you’ll learn in this Python series
- Why choose Python as your first programming language?
- How to install Python on Mac, Windows, and Linux
- Writing Python programs: use a text editor
- How to run Python: Interpreter vs Script
- How to use this blog?
- What to do when you're stuck
- What next

Who is this for?
I am writing this series of tutorials for people who are like me—that is, like the me of a few years ago.
This means relative programming beginners who are teaching themselves. Some want to change jobs, get better pay, or become independent freelance programmers. Others are curious autodidacts who want a cool hobby.
If that's you, great!
Teaching yourself programming requires a few qualities:
Curiosity
Autonomy
Motivation
What you won't need:
Being a genius
Paying for expensive courses
Some inborn mystical ability for tech
You don't need any prior programming knowledge to follow along. I'll introduce concepts little by little, and I won't bombard you with jargon.
print("Hello, world")
That was your first taste of Python programming. Can you guess what it does? (answer: it prints "Hello, world")
See? We're starting easy!
What you’ll learn today
What's Python and why it's great for beginners
How to install Python on Mac, Windows, or Linux
What’s the terminal and how to use it to run your first Python code
What’s a code editor and how to pick one
How this blog series will help you learn Python through projects
What you’ll learn in this Python series
This series of posts is first about learning the programming language Python.
A programming language is like human languages: a tool for communication. Human languages, like French, allow you to communicate with humans. Programming languages allow you to communicate with both humans—your fellow programmers—and computers.
Remember high school? Maybe you took French or Spanish lessons. You learned grammar rules and vocabulary, but I would bet none of it stuck if you didn't use the language. That means talking, writing, and reading. Likewise, to learn a programming language, you need to read and write programs.
There are rules to expressing yourself. Those go beyond the rules of grammar and transcend language barriers. A well-written essay, when translated, will still be a well-written essay. In the same way, you'll learn how to structure a program to make it clear and efficient.
When writing, there are steps to go from a blank page to a polished book or essay. Again, you can make a parallel with programming: there are ways to begin a program, grow it, and polish it.
Why choose Python as your first programming language?
Python is often touted as a beginner-friendly language.
It's 'high-level,' meaning the language does many things for you. You don't have to micromanage it, and you can instead focus on the logic of your program. It is easy to learn and use.
It also gives you access to a rich ecosystem of libraries. Libraries are code written by others that you can reuse in your programs. Whatever your problem, there's a high chance you'll find something useful. That makes Python versatile.
Unlike other less popular languages, Python has a large developer community. This means docs, tutorials, forums, tooling, etc.
Python is available on various platforms, including Mac, Windows, and Linux. You write your code once, and it will run everywhere. Python magnifies the impact your work has on others.
Python will give you the right tools for:
data analysis
web dev
automation
machine learning
etc.
How to install Python on Mac, Windows, and Linux
For historical reasons, you must be careful to install the right Python package. Make sure you install Python 3, not Python 2.
You must use a "command-line interface" (CLI). This might seem intimidating at first, but it's better to get started now than later. A CLI is a tool you'll use very often anyway. It's a way to interact with your operating system using text.
Here are some resources for your operating system:
You will also install pip after installing Python. pip is a program that allows you to download and install modules you can use in your programs). We won't use it soon, but it's a good idea to have it already installed.
For Mac OS
Install Xcode from the App Store
Locate your Terminal app. You can do command + Space, then type "
terminal
".Install Homebrew (instructions here)
Install Python from the Terminal application: type
brew install python
From the terminal, verify the installation:
python3 --version
.When you want to check for updates and upgrade Python, you can use
brew update
brew upgrade python
Next, you should install pip (the Python package manager for installing libraries).
python3 -m pip --version
For Windows
Microsoft has created an official guide to install Python. Go check it out.
For Linux
Python is often preinstalled on Linux systems.
Type python --version
to make sure it's the case.
If not, the way to install Python depends on your distro.
Debian-based distros
Update the package repository:
sudo apt update
Install Python:
sudo apt install python3
Verify your installation:
python3 --version
Install pip:
python -m ensurepip --upgrade
Arch-based distros
Refer to the Arch wiki for general system maintenance.
pacman -S python
python3 --version
python -m ensurepip --upgrade
Writing Python programs: use a text editor
You'll need a text editor to write your programs. Editors are like text processors (e.g., MS Word) but for code.
They let you do neat tricks like syntax highlighting, matching parentheses, auto-formatting, etc.
I've been using Emacs for a very long time. It is a very nice but slightly old-fashioned program. I've heard nice things about VSCode, Eclipse, and Pycharm.
Code editors are a very personal choice. Check out the links I gave you, and pick the one you like the most.
How to run Python: Interpreter vs Script
There are two main ways to run your code.
The interpreter
The interpreter is also known as the REPL (Run-Eval-Print Loop). Using it is like having a discussion with Python. You type something, and it answers back, and so on.
To access it, open your terminal and type python3.
It'll look like this:
hadwill@mycomputer ~ % python3
Python 3.12.2 (v3.12.2:6abddd9f6a, Feb 6 2024, 17:02:06) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
If you type a command, it'll answer. Try it!
>>> print("It works.")
It works.
Running programs
Another way is to create a file for your Python program in your editor. You must append a ".py" extension to the filename to do this. Then, you'll run your program from your terminal / command-line interface (CLI). Here's how you would run a program called "my_program.py
" on a Mac.
% python3 my_program.py
It is roughly similar on Linux and Windows.
How to use this blog?
If you're new to programming, read the chapters in order. Each post contains some key concepts that build on previous posts. Don't worry, though, as I'll repeat important concepts from post to post.
The posts start with a programming project. I'll show you how I created it from scratch so you can get a sense of writing a program. Explanations and exercises go with this project.
As you progress from chapter to chapter, remember to go back and revisit old programs. Refine them with the new concepts you've learned.
You should type the example programs in full, not copy-paste. This is important for memorization. You'll eventually make some typos, but that's OK. You'll learn valuable debugging skills.
What to do when you're stuck
If you don't understand something in the code, you must first find a solution yourself. Nobody knows everything about programming. Looking for answers is an essential skill for every programmer.
Some useful resources are
If you haven't found a solution after searching the Internet, you can ask me a question. I'd be glad to answer it in the relevant comment section. That way, other readers can learn from you.
What next
Now that you're ready, head to the first Python lesson!
Don't hesitate to ask if you've any questions about setting up Python or your environment.
Subscribe to my newsletter
Read articles from Had Will directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
