Python’s with Statement: Manage External Resources Safely

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: Context Managers and Using Python’s with Statement Python’s with statement allows you to manage external resources safely by using objects that support the context manager protocol. These objects automatically handle the setup and cleanup phases of common operations. By using the with statement alongside appropriate context managers, you can focus on your core logic […]

Read more

Working With Python’s .__dict__ Attribute

Python’s .__dict__ is a special attribute in classes and instances that acts as a namespace, mapping attribute names to their corresponding values. You can use .__dict__ to inspect, modify, add, or delete attributes dynamically, which makes it a versatile tool for metaprogramming and debugging. In this video course, you’ll learn about using .__dict__ in various contexts, including classes, instances, and functions. You’ll also explore its role in inheritance with practical examples and comparisons to other tools for manipulating attributes. By […]

Read more

Python 3.14 Release Candidate Lands: Faster Code, Smarter Concurrency

Last month, Python 3.14 reached its first release candidate, pushing the interpreter past beta and onto the home stretch toward its final release on October 7. But that headline was only the start—new library releases also landed, Django celebrated its 20th birthday, and EuroPython brought the community together in Prague. What follows is a quick-read digest of everything that mattered, from core-language breakthroughs to tooling upgrades and community milestones. Feel free to skip straight to whatever interests you most. Python […]

Read more

Quiz: Python Basics: Setting Up Python

Interactive Quiz ⋅ 5 QuestionsBy Martin Breuss Share In this quiz, you will review the key steps for installing Python on Windows, macOS, and Ubuntu Linux. You will recall what the PATH environment variable is for, and what Python distribution to choose. Note: The explanations in the questions will link back to the Windows installation lesson, but all question are kept general, so you’ll be able to answer them independent of which operating system you use. You’ll also revisit how […]

Read more

Reimagining healthcare delivery and public health with AI

[THEME MUSIC FADES]  The book passage I read at the top is from Chapter 7, “The Ultimate Paperwork Shredder.” Public health officials and healthcare system leaders influence the well-being and health of people at the population level. They help shape people’s perceptions and responses to public health emergencies, as well as to chronic disease. They help determine the type, quality, and availability of treatment. All this is critical for maintaining good public health, as well as aligning better health and […]

Read more

Quiz: What Are Mixin Classes in Python?

Interactive Quiz ⋅ 8 QuestionsBy Bartosz Zaczyński Share In this quiz, you’ll test your understanding of What Are Mixin Classes in Python? By working through this quiz, you’ll revisit Python mixins, how they’re used, and the benefits they offer. The quiz contains 8 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck! Related Resources

Read more

What Are Mixin Classes in Python?

Mixins offer a powerful way to reuse code across multiple Python classes without forcing them into a rigid inheritance hierarchy. Instead of building deep and brittle class trees, you can use mixins to share common behaviors in a modular and flexible way. Learn when and how to implement mixin classes effectively in your Python projects. By the end of this tutorial, you’ll understand that: Mixins allow you to add isolated, reusable functionalities to classes without enforcing a strict type hierarchy. […]

Read more

Self-adaptive reasoning for science

Unlocking self-adaptive cognitive behavior that is more controllable and explainable than reasoning models in challenging scientific domains Long-running LLM agents equipped with strong reasoning, planning, and execution skills have the potential to transform scientific discovery with high-impact advancements, such as developing new materials or pharmaceuticals. As these agents become more autonomous, ensuring effective human oversight and clear accountability becomes increasingly important, presenting challenges that  

Read more

Quiz: Mastering While Loops

Interactive Quiz ⋅ 7 QuestionsBy Martin Breuss Share In this quiz, you’ll practice indefinite iteration using the Python while loop. You’ll test your knowledge of constructing basic and complex while loops, interrupting loop execution with break and continue, use the else clause with a while loop, and deal with infinite loops. 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 quiz, you’ll receive a total […]

Read more
1 2 3 977