Skip to content

Commit f7d2cab

Browse files
Ebazhanovactions-user
authored andcommitted
Prettified Code!
1 parent 7ce2ce0 commit f7d2cab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/python-quiz.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2687,10 +2687,10 @@ y = 20
26872687
closure_func = outer_func(x)
26882688
print(closure_func())
26892689
```
2690+
26902691
- [ ] 30
26912692
- [x] 21
26922693
- [ ] 11
26932694
- [ ] 31
26942695

26952696
**Explanation**: When `outer_func(10)` is called, `y` is set to 11 within `outer_func`. The `inner_func`, which has access to `outer_func`'s scope, returns `y` + `x`. When `closure_func()` is called, it uses `y` = `11` (from `outer_func`) and `x` = `10` from the global scope, not from the function’s argument. Therefore, `closure_func()` returns 11 + 10 = 21.
2696-

0 commit comments

Comments
 (0)