PY

Python Tutorial

Learn programming with Python – variables, strings, lists, dictionaries, loops, functions, files and modules.

Python is one of the easiest programming languages to start with and one of the most used – for automation, data, web back ends and more. This track teaches Python 3 from your first print() to functions, files, modules and error handling, with small examples and their exact output.

Every lesson has a short quiz and a practice exercise. To run the examples yourself, install Python from python.org or use any online Python editor.

  1. 1 Python IntroductionWhat Python is, what people build with it, how to install it on Windows, macOS or Linux, and how to…
  2. 2 Python Syntax and VariablesLearn the ground rules of Python code: indentation, comments and case sensitivity, plus how to create, name and update variables.
  3. 3 Python Data TypesNumbers, text, True/False and None: learn the built-in Python data types, how to check them with type() and how to…
  4. 4 Python StringsWork with text in Python: quotes, indexing and slicing, useful string methods, and f-strings for neat, formatted output.
  5. 5 Python OperatorsDo maths and make comparisons in Python: arithmetic, assignment, comparison, logical, membership and identity operators, and their precedence.
  6. 6 Python Conditions (if, elif, else)Make decisions in Python with if, elif and else, combine conditions, write one-line conditional expressions and use match for many…
  7. 7 Python Loops (for and while)Repeat work with Python for and while loops: range(), break and continue, enumerate() and zip(), and nested loops with clear…
  8. 8 Python Lists and TuplesStore many values in one variable with Python lists and tuples: indexing, adding and removing items, sorting, list comprehensions and…
  9. 9 Python Dictionaries and SetsStore data by name with Python dictionaries and keep unique values with sets: access, update, loop, count and compare with…
  10. 10 Python FunctionsWrite reusable Python functions with def: parameters, return values, default and keyword arguments, *args, scope, docstrings and lambda.
  11. 11 Python File HandlingRead and write files in Python with open() and with, file modes, pathlib, and the csv and json modules, with…
  12. 12 Python Modules and Error HandlingReuse code with Python modules and the standard library, create your own module, and handle errors with try, except, else,…