Filter positive and negative numbers Dry Run in PYTHON

Filter positive and negative numbers is an interactive PYTHON dry run visualizer from the Special 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.

Filter positive and negative numbers Program Code

numbers = [-5, -2, 0, 3, 7, -1, 8, -4, 6]

# Filter positive numbers
positives = list(filter(lambda x: x > 0, numbers))

# Filter negative numbers
negatives = list(filter(lambda x: x < 0, numbers))

print(f"Original: {numbers}")
print(f"Positive: {positives}")
print(f"Negative: {negatives}")

View the complete Special programs page.

Program Console Filter positive and negative numbers Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.