Python - Introduction

Overview

Estimated time: 20–30 minutes

Python is a high-level, general-purpose programming language with an emphasis on readability and a rich standard library. This introduction orients you to what Python is good at, how it's used across domains, and what you’ll learn next.

Learning Objectives

  • Describe Python’s key strengths and common use cases.
  • Understand the Python runtime (CPython) and the role of the standard library.
  • Know the immediate next steps: installing Python and running your first program.

Prerequisites

  • None. This is the first lesson.

Why Python?

  • Readable syntax reduces cognitive load (great for teams and teaching).
  • Rich standard library and a massive ecosystem (PyPI) for almost any task.
  • Portable across OSes; excellent tooling and community.

Examples

# A simple greeting
name = "World"
print(f"Hello, {name}!")

Expected Output:

Hello, World!

Common Pitfalls

  • Assuming Python behavior is identical across versions. We’ll target 3.12+, noting features that require 3.10+.
  • Mixing system Python with project Python. Use virtual environments for each project.

Checks for Understanding

  1. What does “batteries-included” mean in the context of Python?
  2. Why do virtual environments matter?
Show answers
  1. It means the standard library covers many tasks without additional installs.
  2. They isolate dependencies per project, avoiding version conflicts.

Exercises

  1. Change the variable name and print a different greeting.
  2. Print two lines: your name and one thing you want to build with Python.