Find average of list elements Dry Run in PYTHON

Find average of list elements 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.

Find average of list elements Program Code

# Find average of list elements
marks = [78, 85, 92, 88, 76, 95, 89]
print("Marks:", marks)

# Calculate average = sum / count
total = 0
for mark in marks:
    total += mark

average = total / len(marks)
print(f"Sum = {total}")
print(f"Count = {len(marks)}")
print(f"Average = {average:.2f}")

# Using built-in functions
avg = sum(marks) / len(marks)
print(f"Using built-ins: {avg:.2f}")

View the complete Lists programs page.

Program Console Find average of list elements Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.