summaryrefslogtreecommitdiff
path: root/Problem36.py
diff options
context:
space:
mode:
authorJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
committerJoshua Drake <joshua.drake@ditchwitch.com>2023-04-07 08:13:49 -0500
commit1161f9a034de06a63538e3a9a0b7717098c744d9 (patch)
tree55bb842b2daa4f096eb7916a8d3630426fc1c376 /Problem36.py
Initial CommitHEADmaster
Diffstat (limited to 'Problem36.py')
-rw-r--r--Problem36.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Problem36.py b/Problem36.py
new file mode 100644
index 0000000..98e898c
--- /dev/null
+++ b/Problem36.py
@@ -0,0 +1,16 @@
+#Completed 9/13/2021 14:26
+def isPalindrome(n):
+ n = list(str(n))
+ m = list(reversed(n))
+ if n == m:
+ return True
+ else:
+ return False
+def isBitPalindrome(n):
+ n = str(bin(n))
+ return isPalindrome(n[2:])
+count = 0
+for x in range(1, 1000000):
+ if(isPalindrome(x) and isBitPalindrome(x)):
+ count+=x
+print("Answer is:", count) \ No newline at end of file