Program Console Vignaankosh.com
Execution Panel
Console is empty.
Find highest scoring student 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.
# Find highest scoring student
students = {
"John": 85,
"Alice": 92,
"Bob": 78,
"David": 96,
"Emma": 88,
"Sophia": 91,
"Michael": 75
}
print("Student Scores:", students)
# Method 1: Using max() with key
top_student = max(students, key=students.get)
top_score = students[top_student]
print(f"\nTop Student: {top_student} with {top_score} marks")
# Method 2: Using items()
top_pair = max(students.items(), key=lambda x: x[1])
print(f"Using items(): {top_pair[0]} → {top_pair[1]}")
# Method 3: Manual iteration
max_student = None
max_marks = -1
for student, marks in students.items():
if marks > max_marks:
max_marks = marks
max_student = student
print(f"Manual method: {max_student} → {max_marks}")
# Method 4: Get top 3 students
top_3 = sorted(students.items(), key=lambda x: x[1], reverse=True)[:3]
print(f"\nTop 3 Students:")
for i, (name, score) in enumerate(top_3, 1):
print(f" {i}. {name}: {score}")