Mutual recursion (Even/Odd detection) Dry Run in PYTHON

Mutual recursion (Even/Odd detection) is an interactive PYTHON dry run visualizer from the Recursion programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Mutual recursion (Even/Odd detection) Program Code

def is_even(n):
    if n == 0:
        return True
    return is_odd(n-1)

def is_odd(n):
    if n == 0:
        return False
    return is_even(n-1)

for num in [7, 8, 0]:
    print(f"{num} is {'Even' if is_even(num) else 'Odd'}")

View the complete Recursion programs page.

Program Console Mutual recursion (Even/Odd detection) Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.