← Back to Tutorials Chapter 1

Getting Started with Python

What is Python?

Python is a high-level, interpreted, general-purpose programming language created by Guido van Rossum and first released in 1991. Its design philosophy emphasizes code readability with significant indentation. Python is dynamically-typed and garbage-collected, supporting multiple programming paradigms including procedural, object-oriented, and functional programming.

A Brief History

Python was conceived in the late 1980s as a successor to the ABC language. Python 2.0 was released in 2000, and Python 3.0 (breaking backward compatibility) arrived in 2008. As of 2025, Python 3.x is the only actively developed version, with Python 2 officially retired on January 1, 2020.

Why Learn Python?

Python is one of the most popular programming languages in the world. It is used in web development (Django, Flask), data science (NumPy, pandas), machine learning (TensorFlow, PyTorch), automation, scripting, and more. Its simple syntax makes it an excellent first language for beginners.

Key Features

Installing Python

Visit python.org/downloads and download the latest version for your operating system. During installation on Windows, make sure to check "Add Python to PATH".

Verify the Installation

Open a terminal (command prompt, PowerShell, or terminal) and run:

python --version

You should see output similar to Python 3.13.x.

Virtual Environments (venv)

A virtual environment is an isolated Python environment that lets you install packages specific to a project without interfering with your system-wide Python installation.

# Create a virtual environment
python -m venv myenv

# Activate it (Windows)
myenv\Scripts\activate

# Activate it (macOS/Linux)
source myenv/bin/activate

# Deactivate when done
deactivate

Your First Program

The quintessential first program in any language is printing "Hello, World!":

print("Hello, World!")

Save this in a file called hello.py and run it with:

python hello.py

Interactive Interpreter

Python also provides an interactive REPL (Read-Eval-Print Loop). Just type python in your terminal and start writing code line by line:

>>> print("Hello from the REPL!")
Hello from the REPL!
>>> 2 + 2
4

Interpreter vs Script

You can run Python in two ways:

Tip: Use the interactive interpreter to test ideas quickly, but always save your work as scripts.

IDE and Editor Setup

You can write Python in any text editor, but a good IDE boosts productivity.

PyCharm

PyCharm (by JetBrains) is a full-featured Python IDE. The free Community Edition is sufficient for learning. It offers intelligent code completion, debugging, and integrated virtual environment management.

VS Code

Visual Studio Code with the Python extension (by Microsoft) is a popular, lightweight alternative. Install the Python extension from the marketplace and you will get linting, debugging, and IntelliSense.

Running Python Code

Whether you use an IDE or a simple text editor, the workflow is the same: write code, save the file, and run python filename.py.

# hello.py
name = input("What is your name? ")
print(f"Hello, {name}! Welcome to Python.")
Python hello world and interpreter
Note: Python uses indentation (4 spaces by convention) to define blocks of code. Do not mix tabs and spaces.

Practice Exercise

Install Python if you haven't already. Create a new virtual environment called learning. Write a script that asks the user for their name, age, and favorite color, then prints a sentence combining all three pieces of information. Run the script both from the terminal and inside your chosen IDE.