π Day 33/150 – Palindrome Number in Python
A Palindrome number is a number that remains the same when reversed.
Example: 121, 1331, 454 are palindrome numbers.
Let’s explore different ways to check palindrome number in Python π
πΉ Method 1 – Using while Loop
n = 121 temp = n rev = 0 while n > 0: digit = n % 10 rev = rev * 10 + digit n //= 10 if temp == rev: print("Palindrome Number") else: print("Not Palindrome")
\✅ Best numeric method.


0 Comments:
Post a Comment