A lot of people ask me how to get started with Python, probably because I use it every day and I won't shut up about it. So here's my attempt at a beginner's guide, written by someone who actually remembers what it was like to be confused by all of this.
Why Python?
I'm not going to give you the usual "Python is simple and readable" speech. You've heard that. What I will say is that Python is practical. You can do web development, data analysis, machine learning, scripting, automation — basically anything you want. And the community is huge, which means when you get stuck (you will), someone has already had the same problem and posted the solution online.
Installing Python
Don't install Python from the official website. On Mac, use Homebrew. On Linux, it's probably already installed or available through your package manager. On Windows, use the Microsoft Store version or WSL.
And please, use Python 3. Python 2 has been dead for years. If a tutorial mentions Python 2, close the tab and find a newer one.
# Mac
brew install python3
# Ubuntu/Debian
sudo apt install python3 python3-pip
# Check it works
python3 --version
Virtual environments from day one
I know, setting up a virtual environment feels like an unnecessary extra step when you just want to write your first "Hello World". Do it anyway. It takes 30 seconds and it will save you from a world of pain later when different projects need different versions of the same library.
python3 -m venv myenv
source myenv/bin/activate # on Mac/Linux
myenv\Scriptsctivate # on Windows
You'll know it's working because your terminal will show (myenv) at the beginning of the prompt. When you're done, just type deactivate.
Your first program
Forget "Hello World". Let's do something slightly more interesting — read a file and count the words.
from collections import Counter
with open('mytext.txt', 'r') as f:
text = f.read()
words = text.lower().split()
word_counts = Counter(words)
for word, count in word_counts.most_common(10):
print(f"{word}: {count}")
This is more useful than printing "hello" and it teaches you several things at once: reading files, string methods, using standard library modules, and formatted output.
Learn these first
Don't try to learn everything. Focus on these fundamentals:
- Variables and data types — numbers, strings, lists, dictionaries
- Control flow — if/else, for loops, while loops
- Functions — defining them, calling them, returning values
- Working with files — reading and writing
- Error handling — try/except, because things will go wrong
Once you're comfortable with those, pick a direction based on what you want to build. Want to do web development? Learn Flask or Django. Data science? Learn Pandas and NumPy. Automation? Learn the os and subprocess modules.
The editor question
Use whatever you want. VS Code is fine, PyCharm is fine, Vim is fine if you're that kind of person. I use VS Code with the Python extension and it does everything I need. Don't spend a week comparing editors — just pick one and start writing code.
Where to find help
- Official docs: docs.python.org — they're actually pretty good
- Stack Overflow: If you have a question, it's probably already answered here
- Real Python: Good tutorials that go beyond the basics
- The Python Discord: Friendly community if you want real-time help
A warning about tutorials
There's a trap called "tutorial hell" where you keep watching tutorials but never actually build anything. The best way to learn Python is to pick a small project and figure out how to build it. It doesn't matter what — a script that renames your photos, a simple website, a bot that sends you weather updates. Building something real teaches you things that tutorials can't.
I learned more Python in two weeks of building my own project than in months of following courses. The messy, frustrating process of making something work is where the actual learning happens.