Alterna · learning material
Functions and recursion
Chapter 39: Programming: functions, subprogrammes and recursions, short explanations, diagrams, trajectory and practices.
What this material covers
- Mission Manager
- Headway
- Functions and Parameters
- Local variables and challenge stacks
- Recursive algorithms
- Workshop
- Skills testing
- Python studio
Content and key concepts
The function isolates the sub-task, the glass saves unfinished calls, and the recursion converts the definition through a smaller argument into a program.
substance and practice
Grade 11
EGE No. 16
ALT
Mission Manager
Each recursive call gets its own parameter and local variable. Leave the missions to see the footage before and after.
return
.
Deepness of mission
def mission(level):
fuel = level * 2
if level == 0: return 1
return fuel + mission(level - 1)
01
Headway
The workshop and the exam test test are not guessing, but the steady skill of analysis and code writing.
39.1 · Theory and track
Functions and Parameters
The function receives arguments, creates local parameters and returns the value. The challenge can be used within a larger expression.
Open topic
39.2 Theory and track
Local variables and challenge stacks
Each call receives a separate stack frame with its parameters and local variables. After return, the frame is removed.
Open topic
39.3 Theory and track
Recursive algorithms
The recursive function contains a base case and transition to a smaller task. The answer is collected when the stack is folded back.
Open topic
39.4 Practice
Workshop
Twenty diagnostic questions with four outcomes and eight programme tasks with additional tests.
Start training
39.5. Monitoring
Skills testing
The timer does not drop when rebooted, correct is hidden until the end, the program task is mandatory.
Open option
39.6 · Copyright code
Python studio
Choose a problem, change the algorithm, and pass the visible and hidden tests in the isolated runtime.
Open the studio.