Student marks processing using map() and filter() Dry Run in PYTHON

Student marks processing using map() and filter() 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.

Student marks processing using map() and filter() Program Code

students = [
    ("Alice", 85, 90, 78),
    ("Bob", 45, 52, 48),
    ("Charlie", 92, 88, 95),
    ("Diana", 38, 42, 40),
    ("Eve", 76, 82, 79)
]

# Calculate average marks and determine pass/fail
processed = list(map(
    lambda s: (s[0], sum(s[1:])/3, "Pass" if sum(s[1:])/3 >= 50 else "Fail"),
    students
))

# Filter students who passed
passed = list(filter(lambda s: s[2] == "Pass", processed))

print("All Students with Average and Status:")
for name, avg, status in processed:
    print(f"  {name}: {avg:.1f} → {status}")

print("\nPassed Students:")
for name, avg, status in passed:
    print(f"  {name}: {avg:.1f}")

# Extract just names of passed students
passed_names = list(map(lambda s: s[0], passed))
print(f"\nNames of passed students: {passed_names}")

View the complete Special programs page.

Program Console Student marks processing using map() and filter() Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.