Search⌘ K
AI Features

Solution Review: Updating Outer Scope Values Again

Understand how to use Python's nonlocal statement to modify variables in the nearest outer scope. Learn the differences between nonlocal and global statements, and recognize common mistakes such as SyntaxErrors when outer variables don't exist. This lesson helps you master scope handling to write clearer and more accurate Python code.

We'll cover the following...

Let’s look at the solution to the coding challenge in the previous lesson.

Solution

...