-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEX16.PY
More file actions
20 lines (15 loc) · 817 Bytes
/
Copy pathEX16.PY
File metadata and controls
20 lines (15 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Exercise 16. Check Palindrome Number
# Practice Problem: Write a program to check if a given number is a palindrome. A palindrome number remains the same when its digits are reversed (e.g., 121, 545).
# Exercise Purpose: This exercise teaches “Algorithmic Reversal.” While strings are easy to reverse in Python, reversing a number mathematically using the modulo (%) and floor division (//) operators deepens understanding of how integers are stored in memory and how to manipulate digits individually.
# Given Input: number = 121
# Expected Output:
# Original number 121
# Yes. given number is palindrome number
def palindrome(num):
string=str(num)
reverse_str=string[::-1]
if num==reverse_str:
print("palindrome")
else:
print("not palindrome")
palindrome(input("enter :"))