Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions binaryofnoispalindromeornot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# input the number
P=int(input('Enter a number: '))

# converting to binary
s=int(bin(P)[2:])

# reversing the binary
r=str(s)[::-1]

# checking the palindrome
if int(r)==s:
print("The binary representation of the number is a palindrome.")
else:
print("The binary representation of the number is not a palindrome.")