On this page

What Is Python?

10 min read TextCh. 1 — Python Fundamentals

What Is Python?

Python is a high-level, general-purpose programming language created by Guido van Rossum and first released in 1991. Over three decades later, it consistently ranks as the most popular programming language in the world according to the TIOBE Index, the Stack Overflow Developer Survey, and the GitHub Octoverse report. Its success is not accidental — Python was designed from the start with a clear philosophy: code should be readable, expressive, and simple without sacrificing power.

The language's design philosophy is captured in "The Zen of Python," a short set of aphorisms you can read at any time by running import this in the Python interpreter. The most famous of these principles is: "Readability counts." Python enforces this by using indentation to define code blocks instead of curly braces, making programs look almost like structured English prose.

Why Python in 2025?

Python's popularity has exploded in recent years because it has become the dominant language in three of the most important fields in modern software:

Data Science and Machine Learning: Libraries like NumPy, pandas, Matplotlib, scikit-learn, PyTorch, and TensorFlow are all Python-first. If you want to work with data or build AI models, Python is essentially non-negotiable.

Web Development: Frameworks like Django and FastAPI allow you to build production-grade web APIs and applications quickly. FastAPI in particular has seen massive adoption for building modern REST APIs with automatic documentation and type safety.

Automation and DevOps: Python is the scripting language of choice for system administrators, DevOps engineers, and anyone who wants to automate repetitive tasks — from renaming files in bulk to orchestrating cloud infrastructure.

Beyond these fields, Python is used in game development, scientific computing, cybersecurity, finance, bioinformatics, and more. It is a true general-purpose language.

Python 3.14 and the JIT Compiler

Python 3.14 is the current stable release and brings one of the most significant performance improvements in the language's history: an experimental Just-In-Time (JIT) compiler. Historically, one of Python's main criticisms was speed — it is interpreted and dynamically typed, which makes it slower than compiled languages like C++ or Rust. The JIT compiler addresses this by compiling frequently executed "hot" code paths into native machine code at runtime, rather than re-interpreting bytecode every time.

In Python 3.14, the JIT is opt-in and experimental, but benchmarks show significant speedups for CPU-intensive loops and numeric code. To enable it, you run Python with the --enable-experimental-jit flag:

python --enable-experimental-jit your_script.py

Other notable improvements in Python 3.14 include enhanced error messages (Python has been progressively making error messages friendlier since 3.10), improvements to the typing module, and template strings (t-strings) for safer string interpolation.

Installing Python 3.14

The official way to get Python is from python.org. Download the installer for your operating system and follow the prompts. On Windows, make sure to check the box that says "Add Python to PATH" before clicking Install.

To verify your installation, open a terminal and run:

python --version

You should see output like Python 3.14.x. On some systems, especially Linux and macOS, you may need to use python3 instead of python to get Python 3 (as opposed to the legacy Python 2).

For managing multiple Python versions on the same machine, consider using pyenv (macOS/Linux) or pyenv-win (Windows). This lets you switch between Python versions per project.

The Python REPL

One of Python's greatest features for learning is its interactive interpreter, also called the REPL (Read-Eval-Print Loop). You launch it by simply typing python in your terminal with no arguments:

python

You will see a prompt like this:

Python 3.14.0 (main, Apr  1 2025, 10:00:00)
Type "help", "copyright", "credits" or "license" for more information.
>>>

The >>> is the REPL prompt. You can type any valid Python expression or statement and see the result immediately:

>>> 2 + 2
4
>>> "Hello, Python!"
'Hello, Python!'
>>> len("Python")
6

The REPL is invaluable for experimenting with code snippets, testing functions, and exploring libraries — you get instant feedback without writing a file, saving it, and running it. Professional Python developers use the REPL constantly.

To exit the REPL, type exit() or press Ctrl+D (on macOS/Linux) or Ctrl+Z then Enter (on Windows).

Your First Python Script

While the REPL is great for experimentation, real programs live in .py files. Create a file called hello.py with your favorite text editor and write:

# This is a comment — Python ignores everything after the # symbol
name = "Python"
version = 3.14

print(f"Hello from {name} {version}!")
print(f"The square of 7 is {7 ** 2}.")

Run it from your terminal:

python hello.py

Output:

Hello from Python 3.14!
The square of 7 is 49.

Let's break down what happened:

  • name = "Python" — Assigns the string "Python" to the variable name. No type declaration needed.
  • version = 3.14 — Assigns a floating-point number. Python infers the type automatically.
  • print(...) — Calls the built-in print function to output text to the terminal.
  • f"Hello from {name} {version}!" — An f-string (formatted string literal). The f prefix tells Python to evaluate any expressions inside {} and embed the result.

Code Example: Exploring Python Basics in the REPL

# Arithmetic operators
>>> 10 + 3        # Addition
13
>>> 10 - 3        # Subtraction
7
>>> 10 * 3        # Multiplication
30
>>> 10 / 3        # True division — always returns float
3.3333333333333335
>>> 10 // 3       # Floor division — rounds down
3
>>> 10 % 3        # Modulo — remainder
1
>>> 10 ** 3       # Exponentiation
1000

# Built-in functions
>>> abs(-42)      # Absolute value
42
>>> round(3.7)    # Round to nearest integer
4
>>> type(3.14)    # Check the type of a value
<class 'float'>
>>> type("hello")
<class 'str'>
# String operations
greeting = "Hello, World!"
print(len(greeting))          # 13 — number of characters
print(greeting.upper())       # HELLO, WORLD!
print(greeting.lower())       # hello, world!
print(greeting.replace("World", "Python"))  # Hello, Python!
print(greeting[0:5])          # Hello — slicing
print(greeting[-6:])          # orld! — negative indexing

Notice that Python uses zero-based indexing (the first character is at index 0) and supports negative indexing (index -1 refers to the last character). String slicing with [start:end] returns a substring from start up to but not including end.

Python's Standard Library

One of Python's superpowers is its "batteries included" philosophy. The standard library ships with modules for almost everything you might need: reading files, making HTTP requests, working with dates and times, generating random numbers, parsing JSON, sending emails, running web servers, and much more — all without installing anything extra.

For example, you can get the current date with no external packages:

from datetime import date

today = date.today()
print(f"Today is {today}")          # Today is 2025-04-02
print(f"Year: {today.year}")        # Year: 2025
print(f"Day of week: {today.weekday()}")  # 0=Monday, 6=Sunday

This is just a tiny glimpse. As you progress through this course, you will explore many parts of the standard library and popular third-party packages.


tip type: tip title: "Use the REPL as your scratchpad"

Whenever you encounter a concept you are not sure about, try it in the REPL immediately. Type type(some_value) to check what type Python assigned, dir(some_object) to see all its methods, or help(some_function) to read its documentation — all without leaving your terminal.


tip type: info title: "Python 2 is dead"

Python 2 reached end-of-life on January 1, 2020. If you see Python 2 syntax online (such as print "hello" without parentheses), ignore it. This course uses Python 3.14 exclusively.


nextSteps

  • variables-and-types