Program Console Vignaankosh.com
Execution Panel
Console is empty.
Find sum of tuple elements is an interactive PYTHON dry run visualizer from the Tuples 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.
# Find sum of all elements in tuple
nums = (8, 16, 24, 32, 40, 48)
print("Tuple:", nums)
# Method 1: Using sum()
print(f"Using sum(): {sum(nums)}")
# Method 2: Manual loop
total = 0
for num in nums:
total += num
print(f"Manual sum: {total}")
# Works only for numeric tuples
mixed = (1, 2, "3") # This would cause TypeError
print("\nNote: sum() only works for numeric tuples")