Geometric Progression (nth term) Dry Run in PYTHON

Geometric Progression (nth term) 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.

Geometric Progression (nth term) Program Code

def gp_term(a, r, n):
    if n == 1:
        return a
    return r * gp_term(a, r, n-1)

a, r, pos = 3, 2, 5
print(f"GP: a={a}, r={r}")
print(f"{pos}th term = {gp_term(a, r, pos)}")

View the complete Recursion programs page.

Program Console Geometric Progression (nth term) Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.