Python tutorials

Skip Ahead in Loops With Python’s Continue Keyword

Until now, you’ve focused on how to use the continue statement effectively in your code. But have you ever wondered what Python actually does when it encounters continue inside a loop? This section pulls back the curtain to explore how Python parses and executes your code, helping you understand what’s really going on when your loops skip ahead. Understanding the Official Documentation As you learned earlier, continue only works inside a loop—it has no function outside a loop and will […]

Read more

Python’s asyncio: A Hands-On Walkthrough

Watch Now This tutorial has a related video course created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Hands-On Python 3 Concurrency With the asyncio Module Python’s asyncio library enables you to write concurrent code using the async and await keywords. The core building blocks of async I/O in Python are awaitable objects—most often coroutines—that an event loop schedules and executes asynchronously. This programming model lets you efficiently manage multiple I/O-bound tasks […]

Read more

Working With Python’s Built-in Exceptions

Python has a complete set of built-in exceptions that provide a quick and efficient way to handle errors and exceptional situations in your code. Knowing the most commonly used built-in exceptions is key for you as a Python developer. This knowledge will help you debug code because each exception has a specific meaning that can shed light on your debugging process. You’ll also be able to handle and raise most of the built-in exceptions in your Python code, which is […]

Read more

Quiz: Bitwise Operators in Python

Interactive Quiz ⋅ 17 QuestionsBy Bartosz Zaczyński Share In this quiz, you’ll test your understanding of the Bitwise Operators in Python. By working through this quiz, you’ll revisit how to use Python’s bitwise AND (&), OR (|), XOR (^), NOT (~), left and right shifts (), and bitmasks. You’ll also see practical examples for manipulating data at the bit level. Good luck! The quiz contains 17 questions and there is no time limit. You’ll get 1 point for each correct […]

Read more

Bitwise Operators in Python

Watch Now This tutorial has a related video course created by the Real Python team. Watch it together with the written tutorial to deepen your understanding: Binary, Bytes, and Bitwise Operators in Python Computers store all kinds of information as a stream of binary digits called bits. Whether you’re working with text, images, or videos, they all boil down to ones and zeros. Python’s bitwise operators let you manipulate those individual bits of data at the most granular level. You […]

Read more

Exploring Python Closures: Examples and Use Cases

In Python, a closure is typically a function defined inside another function. This inner function grabs the objects defined in its enclosing scope and associates them with the inner function object itself. The resulting combination is called a closure. Closures are a common feature in functional programming languages. In Python, closures can be pretty useful because they allow you to create function-based decorators, which are powerful tools. In this video course, you’ll: Learn what closures are and how they work […]

Read more

What Does isinstance() Do in Python?

Python’s isinstance() function helps you determine if an object is an instance of a specified class or its superclass, aiding in writing cleaner and more robust code. You use it to confirm that function parameters are of the expected types, allowing you to handle type-related issues preemptively. This tutorial explores how isinstance() works, its use with subclasses, and how it differs from type(). By the end of this tutorial, you’ll understand that: isinstance() checks if an object is a member […]

Read more

Python Scope and the LEGB Rule: Resolving Names in Your Code

The scope of a variable in Python determines where in your code that variable is visible and accessible. Python has four general scope levels: local, enclosing, global, and built-in. When searching for a name, Python goes through these scopes in order. It follows the LEGB rule, which stands for Local, Enclosing, Global, and Built-in. Understanding how Python manages the scope of variables and names is a fundamental skill for you as a Python developer. It helps you avoid unexpected behavior […]

Read more

Getting Started With marimo Notebooks

marimo notebooks redefine the notebook experience by offering a reactive environment that addresses the limitations of traditional linear notebooks. With marimo, you can seamlessly reproduce and share content while benefiting from automatic cell updates and a correct execution order. Discover how marimo’s features make it an ideal tool for documenting research and learning activities. By the end of this video course, you’ll understand that: marimo notebooks automatically update dependent cells, ensuring consistent results across your work. Reactivity allows marimo to […]

Read more

Quiz: How to Debug Common Python Errors

Interactive Quiz ⋅ 7 QuestionsBy Geir Arne Hjelle Share In this quiz, you’ll test your understanding of How to Debug Common Python Errors. Debugging means identifying, analyzing, and resolving issues in your Python code. You’ll revisit reading tracebacks, using print() for value tracking, setting breakpoints to pause execution, and writing tests to catch errors. Good luck! The quiz contains 7 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the […]

Read more
1 2 3 4 5 6 198