Learn / Beginner

Python Beginner

From zero to writing real programs: values, text, collections, decisions, loops, functions and files.

12 free lessons · about 2.1 hours · runnable code, exercises and quizzes

  1. 1What is Python?What Python is, why it's the most popular language for AI and data, how to install it in 2026 and how to run your first line of code.7 min
  2. 2Your first programWrite and run your first Python program: print(), comments, running a .py file, the interactive shell and reading your first error message.8 min
  3. 3VariablesPython variables explained: creating and naming variables, snake_case, dynamic types, type(), multiple assignment, constants and f-strings.9 min
  4. 4NumbersPython numbers: int and float, arithmetic operators, integer division and remainder, powers, rounding, converting text to numbers and why 0.1 + 0.2 isn't 0.3.10 min
  5. 5StringsPython strings: quotes, indexing and slicing, useful methods like upper, strip, split and replace, f-string formatting and why strings can't be changed in place.11 min
  6. 6ListsPython lists: creating, indexing and slicing, adding and removing items, sorting, checking membership, nested lists and the copy trap every beginner meets.11 min
  7. 7Tuples and setsPython tuples and sets: fixed records with tuples and unpacking, unique values with sets, set operations like union and intersection, and when to use each.9 min
  8. 8DictionariesPython dictionaries: key-value pairs, reading safely with get(), adding and updating, looping with items(), counting with a dictionary and nested data like JSON.11 min
  9. 9ConditionsPython if, elif and else: comparisons, and/or/not, truthy and falsy values, one-line conditional expressions and pattern matching with match-case.11 min
  10. 10LoopsPython for and while loops: looping over lists and strings, range(), enumerate() and zip(), break and continue, and how to avoid infinite loops.12 min
  11. 11FunctionsPython functions: def and return, parameters and default values, keyword arguments, type hints, docstrings, *args and **kwargs, scope and the mutable default trap.13 min
  12. 12Files and errorsRead and write text files in Python with open() and pathlib, handle CSV data, and deal with errors using try, except, else, finally and raise.13 min