Python Lessons

A collection of free, in-depth Python lessons for beginners on core topics.

Python Booleans

A Boolean is a data type that has either one of two values representing a conceptual "true" or "false". Booleans are named after the mathematician George Boole, who was a pioneer of mathematical logic. In programming, they are used for decision-making, (i.e. to determine whether the computer should do something or not.

Python Numbers

Numbers are a fundamental aspect of computer programming. Python provides robust support for numeric operations and data types. This lesson covers the three built-in numeric types available in Python: integers, floating-point numbers, and complex numbers.

Python Strings

A Python string is a sequence of text characters. Strings are among the most commonly used data types in Python, and essential for handling text data. Python strings are easy to use and in many ways, work like other Python collections data structures, such as lists and tuples, do. They can be considered ordered collections of individual characters.

Python Variables

Variables are a fundamental part of any programming language. They provide a way to store, access, and remember data for later use. You can think of variables as containers that store basic information of various types, such as numbers and text, or complex data structures that are composed of combinations of those.

Python Context Managers

Python context managers provide a convenient way to manage resources, such as files, network connections, and locks. They enable automatic setup and teardown operations, saving development effort, simplifying code, minimizing errors. Context managers further ensure that resources are properly managed even in the presence of exceptions or errors.