Python basics 1: Hello world!

Python Basics 1: Hello World!" is an inviting introduction to Python programming, tailored for beginners and data analysts. Roos, a data analyst himself, shares his expertise in Python, emphasizing its intuitiveness and versatility for various tasks, including data analysis, AI, and web development.

Python basics 1: Hello world!

Introduction

Ever since becoming a data analyst 2 years ago, Python has been one of my most-used programming languages. It's a great match for data analysis because of its intuitiveness and extensive external libraries. That last part means you're able to make Python suitable for almost any job.

Since Python has been such a valuable language for me, I'd like to share my knowledge of it in a small series. We'll start with this first post, covering the installation and creation of our first program.

Why would you want to follow this series and learn Python? I can think of 4 main reasons:

  1. Python is easy to learn and thus a great start for beginner data analysts
  2. There are a lot of libraries available, which make Python suitable for a lot of tasks. Probably most of your ETL tasks as well.
  3. Its popularity means you can find a lot of information about Python online. This accelerates your learning curve and efficiency troubleshooting later on.
  4. The wide variety of domains in which Python is demanded. Think of data engineering, AI, web development, and more.

Rather watch than read?

Python installation

This tutorial is for Mac users. First, make sure to install the package manager Homebrew. This can be done by typing and executing the following command in your terminal window:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

After you've installed Homebrew, go ahead and install Python by running this command in your terminal.

brew install python3

This will install the latest version of Python 3 (the most recent version) on your system. Verify the installation by running the following command:

python3 --version

You should see the version of Python you've just installed now.

Writing your first Python program

To organize this course, create a new folder for it:

Then open a text editor, I recommend Visual Studio Code, and open your new folder for this series.

Create a new file and select "Text file" if asked.

Then type in the following line:

print ("Hello world")

Save this file as "lesson1.py".

Afterward, open your terminal and navigate to the directory of this file. I use a free terminal called Warp, which can assist you with this. Press ^ + space to get AI support and ask how to navigate to your folder. Once you're in there, type the following code:

python3 lesson1.py

This should print 'Hello world' on your screen. Congratulations on writing and running your first Python code!

I hope to see you again in the next part of this course in which we'll write and use our first function.