Program Console Vignaankosh.com
Execution Panel
Console is empty.
Separate even and odd numbers 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.
# Separate even and odd numbers
numbers = [12, 7, 23, 44, 31, 18, 9, 56, 41, 38, 27]
print("Original:", numbers)
even = []
odd = []
for num in numbers:
if num % 2 == 0:
even.append(num)
else:
odd.append(num)
print(f"Even numbers: {even}")
print(f"Odd numbers: {odd}")
# Using list comprehension
even_comp = [num for num in numbers if num % 2 == 0]
odd_comp = [num for num in numbers if num % 2 != 0]
print(f"\nList comp - Even: {even_comp}")
print(f"List comp - Odd: {odd_comp}")