Program Console Vignaankosh.com
Execution Panel
Console is empty.
Count even numbers in tuple 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.
# Count even numbers in tuple
numbers = (14, 9, 26, 48, 33, 20, 11, 58, 43, 40, 29)
print("Tuple:", numbers)
# Method 1: Using loop
even_count = 0
even_list = []
for num in numbers:
if num % 2 == 0:
even_count += 1
even_list.append(num)
print(f"Even numbers count: {even_count}")
print(f"Even numbers: {even_list}")
# Method 2: Using list comprehension
even_count_comp = sum(1 for num in numbers if num % 2 == 0)
print(f"Using comprehension: {even_count_comp}")