Starting with Python
Before we actually start writing code, we need to download and install Python and then pick a code editor. That’s what we’ll cover in this short post.
Installing Python
Step 1: Download Python
- Go to python.org.
- Download the latest version for your operating system (Windows, macOS, or Linux).
- During installation, make sure to check the box that says “Add Python to PATH.”
- This makes sure you can run Python from the command line without extra setup.
Step 2: Verify the Installation
Let’s check that Python was installed correctly.
- On Windows: Open Command Prompt (search for
cmd
in the Start Menu). - On Mac: Open Terminal (search for
Terminal
in Spotlight Search).
Type this command:
python --version
If everything worked, you’ll see the version number printed.
Troubleshooting Installation Issues
If something doesn’t go quite right, don’t worry—there are plenty of other guides to walk you through it.
Here are some useful guides from geeksforgeeks:
Choosing an Editor
Python code can be written in a bunch of different editors. Try a few out and see what feels right.
- Jupyter Notebook – Great for beginners and especially good for data analysis.
- VS Code – An editor with excellent Python support. This is my go-to because I use multiple languages. It is extensible, so you can add plugins and customize it however you like.
- IDLE– Python’s built-in editor. It’s basic, but it does the job.
- PyCharm – PyCharm is built specifically for Python. Great if you’re doing bigger projects.
Running Python Code
There are several ways to run Python:
- In a script – Save your code in a
.py
file and run it. - In a Jupyter Notebook – Great for running code one chunk at a time.
- In the terminal/command prompt – You can run Python interactively right from the command line.
Try this simple command in whichever setup you choose:
print("Hello, Python!")
If you see that message printed back to you, you’re good to go!
What’s Next?
In the next post, we’ll introduce variables. After that, we’ll take a look at the fictional dataset we’ll be using throughout the series.
See you in the next one!
Recommended Python Books
- Fluent Python: Clear, Concise, and Effective Programming
- Practical Statistics for Data Scientists: 50+ Essential Concepts Using R and Python
- Python for Data Analysis: Data Wrangling with pandas, NumPy, and Jupyter
- Learning Python: Powerful Object-Oriented Programming
- Python Crash Course
- Python Programming for Beginners
- Pandas Cookbook