Count even numbers in list Dry Run in PYTHON

Count even numbers in list is an interactive PYTHON dry run visualizer from the Lists 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 list Program Code

# Count even numbers in list
numbers = [12, 7, 23, 44, 31, 18, 9, 56, 41, 38, 27]
print("List:", numbers)

even_count = 0
even_numbers = []

for num in numbers:
    if num % 2 == 0:
        even_count += 1
        even_numbers.append(num)

print(f"Total even numbers: {even_count}")
print(f"Even numbers list: {even_numbers}")

# Also count odd numbers (by subtraction)
odd_count = len(numbers) - even_count
print(f"Odd numbers count: {odd_count}")

View the complete Lists programs page.

Program Console Count even numbers in list Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.