From 062a768d0b11f62a7f55e8416be05498027f4434 Mon Sep 17 00:00:00 2001 From: amitjuneja2103 <65065528+amitjuneja2103@users.noreply.github.com> Date: Mon, 4 Oct 2021 20:19:12 +0530 Subject: [PATCH] Create binaryofnoispalindromeornot.py --- binaryofnoispalindromeornot.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 binaryofnoispalindromeornot.py diff --git a/binaryofnoispalindromeornot.py b/binaryofnoispalindromeornot.py new file mode 100644 index 0000000..7afe479 --- /dev/null +++ b/binaryofnoispalindromeornot.py @@ -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.")