Keep adding numbers until user enters 0 Dry Run in PYTHON

Keep adding numbers until user enters 0 is an interactive PYTHON dry run visualizer from the While 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.

Keep adding numbers until user enters 0 Program Code

# Sum numbers until user enters 0
total = 0
num = int(input("Enter a number (0 to stop): "))

while num != 0:
    total += num
    num = int(input("Enter another number (0 to stop): "))

print(f"Total sum = {total}")

View the complete While programs page.

Program Console Keep adding numbers until user enters 0 Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.