Pass tuple, return sum and product Dry Run in PYTHON

Pass tuple, return sum and product is an interactive PYTHON dry run visualizer from the Functions 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.

Pass tuple, return sum and product Program Code

def process_tuple(t):
    """Return sum and product of tuple elements"""
    total = sum(t)
    product = 1
    for num in t:
        product *= num
    return total, product

data = (2, 3, 4, 5)
s, p = process_tuple(data)
print(f"Tuple: {data}")
print(f"Sum: {s}, Product: {p}")

View the complete Functions programs page.

Program Console Pass tuple, return sum and product Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.