← All courses

Beginner

Python Fundamentals

Learn Python fundamentals in 16 practical steps, from expressions and common errors to classes, generators, file I/O, tests, and linting.

For Curious learners who want to write, test, and run useful Python 3 programs

What you will learn

  • Read a compact Python reference and use common built-in functions.
  • Write expressions with clear operator precedence and diagnose common errors.
  • Use conditions, loops, lists, dictionaries, and nested data to solve small problems.
  • Organize code with modules, packages, functions, classes, generators, and appropriate scope.
  • Set up a Python development environment and use file I/O, tests, and linting.

Where to use Python

  • Automating small repetitive tasks with scripts.
  • Processing text and structured data.
  • Building a foundation for later study in web development, data analysis, or scripting.

What this course does not cover

  • This short course is not a complete reference for the Python language or its standard library.
  • A tutorial alone is not enough preparation for production systems that need testing, packaging, security, and deployment practices.

How to use this course

Work through the chapters in order. Run each example in a Python 3 interpreter or save it in a .py file, then change it and observe what happens. The exercises are prompts for practice, not tests of memorization.

This course begins with a quick-reference chapter, then builds up from expressions and errors to control flow, collections, and reusable code. It finishes with development setup, file I/O, and basic quality checks. Google’s Python Class is designed for learners with some programming experience; this course introduces those ideas more gradually.

Examples use Python 3. Check the official documentation when you need details for the version installed on your computer. The mnemonics BODMAS and PEMDAS are informal memory aids; follow Python's documented operator precedence, especially when operators share the same precedence.

Python course roadmap from expressions and collections through reusable code, files, tests, and linting

The roadmap follows the topics in this course and the Python Tutorial.

Course chapters

  1. 01Introduction, links, and a quick referenceKnow where to continue learning and keep a small reference to useful built-ins close at hand.
  2. 02Variables and arithmetic orderName values, work with basic types, and understand Python operator precedence.
  3. 03Errors you will encounterRead Python error messages and recognize common syntax and runtime failures.
  4. 04Control flow: conditions and conditional expressionsMake decisions using if/elif/else, comparisons, and Python conditional expressions.
  5. 05Modules and packagesCreate a small importable package and understand the import details that help avoid common pitfalls.
  6. 06ListsStore ordered collections, access items, and use common list operations.
  7. 07LoopsRepeat actions with for and while loops and control when iteration ends.
  8. 08FunctionsDefine reusable behavior with parameters, return values, and docstrings.
  9. 09Dictionaries, nesting, and a secret auctionRepresent named data, combine dictionaries and lists, and use nested records to find a winning bid.
  10. 10Scope and where names liveUnderstand local and outer names and avoid surprising changes to global state.
  11. 11Classes and objectsBundle related data and behavior in a class when a program benefits from its own object type.
  12. 12GeneratorsProduce values one at a time with yield instead of building every result up front.
  13. 13Development environment and machine setupInstall Python, create a project, and isolate its packages in a virtual environment.
  14. 14Input and outputRead user input and text files, and write output safely with clear encoding.
  15. 15Test and lint your codeCheck behavior with unittest and improve code consistency with a linter and formatter.
  16. 16Python function indexSearch common Python built-ins, collection methods, and file operations.

References and further reading