Check if a number is palindrome Dry Run in PYTHON

Check if a number is palindrome 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.

Check if a number is palindrome Program Code

# Check if number is palindrome
num = int(input("Enter a number: "))
original = num
rev = 0

while num > 0:
    digit = num % 10
    rev = rev * 10 + digit
    num //= 10

if original == rev:
    print(f"{original} is a palindrome")
else:
    print(f"{original} is NOT a palindrome")

View the complete While programs page.

Program Console Check if a number is palindrome Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.