Sum of squares of first N numbers Dry Run in PYTHON

Sum of squares of first N numbers 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.

Sum of squares of first N numbers Program Code

def sum_of_squares(n):
    if n == 1:
        return 1
    return n*n + sum_of_squares(n-1)

N = 5
print(f"Sum of squares 1 to {N} = {sum_of_squares(N)}")

View the complete Recursion programs page.

Program Console Sum of squares of first N numbers Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.