Mouse in the Cabinet (Solution)
00:00
The cabinet_items, which is a list of the keys and the sunglasses, is the local scope from the perspective of the mouse.
00:08
And then in the enclosing scope, you can find the basement items which are bed and cabinet in a list. So from the perspective of the mouse, that’s not in the function where the mouse is sitting in, but it’s inside of the enclosing function, which is explore_basement().
00:24 And so there is the enclosing scope with basement items.
00:28
Then in the global scope, there is address. If you have a look at the code, there is no function surrounding the address variable, but it’s just sitting there.
00:38 So that’s the global scope. And you will work with this global scope in this Python Basics Exercises video course here and there so make a mental note for this one.
00:50
And then the print() function is in the built-in scope because it’s available in Python anywhere. So that makes the print() function part of the built-in scope.
Become a Member to join the conversation.
Ismar on Nov. 11, 2025
I’m confused. In the sample code, there is code very similar to mouse in the cabinet, with a
explore_basement()function but it’s in a file calledrename_palace_exercise.pyand doesn’t have a list ofcabinet_itemsbut rather anaddressvariable. I think something is mixed up here.