← All tracks
Functions
BeginnerFoundations
Arguments, scope and the LEGB rule, closures, recursion, first-class and higher-order functions, and the classic gotchas.
20 lessons 4 labs 1 projects ~9h
Prerequisites: Python Fundamentals
0%track
Lessons in this build
Scope & the LEGB Rule
Scope is the region of code where a name is visible, and the LEGB rule (Local, Enclosing, Global, Built-in) is the fixed order Python searches to resolve every name you use.
interactive visualizerClosures
A closure is a function that remembers variables from the scope where it was defined, even after that scope has finished executing.
interactive visualizerWhy it matters
Interview importance 5/5 · production importance 4/5.
Recommended next
Closures