TExcelTAD
Home › Python › Python Intro

Python Introduction

Python is a general-purpose programming language that is famous for being easy to read. Its code looks a lot like plain English, it needs very little punctuation, and it comes with a huge standard library — people often describe Python as "batteries included".

Python was created by Guido van Rossum and first released in 1991. Today it is one of the most popular programming languages in the world, used by beginners writing their first program and by large companies running critical systems.

What can Python do?

  • Automate boring tasks: renaming files, filling spreadsheets, sending reports
  • Build web applications and APIs (Django, Flask, FastAPI)
  • Analyse data and draw charts (pandas, NumPy, Matplotlib)
  • Train machine-learning models (scikit-learn, PyTorch, TensorFlow)
  • Write small command-line tools and glue different programs together
  • Teach programming — its clean syntax keeps the focus on ideas, not symbols

Why learn Python?

Feature What it means for you
Readable syntax Programs are short and easy to understand months later
Interpreted Run code immediately, no separate compile step
Dynamically typed You don't have to declare the type of every variable
Huge ecosystem Hundreds of thousands of packages on PyPI
Cross-platform The same script runs on Windows, macOS and Linux

Python versions

This course uses Python 3. Python 2 reached its end of life in 2020 and should not be used for new code. When a feature needs a recent version (for example the match statement needs Python 3.10), the lesson will say so.

Note: The playgrounds on ExcelTAD run real CPython inside your browser using Pyodide (Python compiled to WebAssembly). The first run downloads Python, so it can take a few seconds. After that, runs are fast.

Your first Python program

A complete Python program can be a single line. There is no main function and no class you must write first — the interpreter simply runs the file from top to bottom. Press ▶ Run:

python · try it yourself
print("Hello, World!")
Hello, World!

print() is a built-in function that writes text to the screen. The text inside the quotes is called a string.

Tip: Every playground is editable. Change the message, then press Ctrl+Enter to run it again.

Python runs line by line

Statements are executed in order, one after another:

python · try it yourself
print("Python is readable.")
print("Python is versatile.")
print("Python is fun!")
Python is readable.
Python is versatile.
Python is fun!

A small taste of what's coming

Here is a slightly bigger program. Don't worry about understanding every part yet — variables, lists, loops and f-strings each get their own lesson.

python · try it yourself
languages = ["Python", "Rust", "JavaScript"]

for position, name in enumerate(languages, start=1):
    print(f"{position}. {name} has {len(name)} letters")
1. Python has 6 letters
2. Rust has 4 letters
3. JavaScript has 10 letters

Notice that there are no curly braces and no semicolons. Python uses indentation (the spaces at the start of a line) to group the body of the loop. You will learn the rules in the Syntax lesson.

Python compared to other languages

  • Python uses new lines to finish a statement, where many languages use semicolons.
  • Python uses indentation to define blocks, where many languages use curly brackets.
  • Python checks types while the program runs, not before it starts.

Test yourself

Which built-in function writes text to the screen?

  1. echo()
  2. write()
  3. print()
  4. console.log()

How does Python mark which lines belong to a block such as a loop body?

  1. Curly braces
  2. Indentation
  3. BEGIN/END keywords
  4. Semicolons

Which major version of Python should new code use?

  1. Python 1
  2. Python 2
  3. Python 3
  4. Any of them