Program Console Vignaankosh.com
Execution Panel
Console is empty.
Simple Menu System using while loop 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.
# Simple calculator menu using while loop
while True:
print("\n===== MENU =====")
print("1. Add two numbers")
print("2. Subtract two numbers")
print("3. Multiply two numbers")
print("4. Divide two numbers")
print("5. Exit")
choice = int(input("Enter your choice (1-5): "))
if choice == 5:
print("Thank you for using! Goodbye!")
break
elif 1 <= choice <= 4:
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
if choice == 1:
print(f"{a} + {b} = {a + b}")
elif choice == 2:
print(f"{a} - {b} = {a - b}")
elif choice == 3:
print(f"{a} × {b} = {a * b}")
elif choice == 4:
if b != 0:
print(f"{a} ÷ {b} = {a / b}")
else:
print("Error: Division by zero!")
else:
print("Invalid choice! Please enter 1-5")