Separate even and odd values from dictionary Dry Run in PYTHON

Separate even and odd values from dictionary is an interactive PYTHON dry run visualizer from the Dict 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 values from dictionary Program Code

# Separate even and odd values from dictionary
numbers = {"a": 15, "b": 22, "c": 37, "d": 44, "e": 51, "f": 68, "g": 73}
print("Original:", numbers)

# Separate values using a loop
even_values = {}
odd_values = {}
for key, value in numbers.items():
    if value % 2 == 0:
        even_values[key] = value
    else:
        odd_values[key] = value

print(f"Even values: {even_values}")
print(f"Odd values: {odd_values}")

View the complete Dict programs page.

Program Console Separate even and odd values from dictionary Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.