Calculate average of n numbers Dry Run in PYTHON

Calculate average of n numbers is an interactive PYTHON dry run visualizer from the For 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.

Calculate average of n numbers Program Code

# Calculate average of n numbers
n = int(input("How many numbers? "))

sum = 0
for i in range(n):
    num = float(input(f"Enter number {i+1}: "))
    sum += num

average = sum / n
print(f"\nSum = {sum}")
print(f"Average = {average:.2f}")

View the complete For programs page.

Program Console Calculate average of n numbers Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.