Find average of set elements Dry Run in PYTHON

Find average of set elements is an interactive PYTHON dry run visualizer from the Sets 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 set elements Program Code

# Find average of set elements
marks = {78, 85, 92, 88, 76, 95, 89}
print("Marks:", marks)

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

# Manual calculation
total = 0
for mark in marks:
    total += mark
avg_manual = total / len(marks)
print(f"Manual average: {avg_manual:.2f}")

View the complete Sets programs page.

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