feat(solution): problem #36

main
steven 2023-08-01 21:12:26 -04:00
parent 1438f0d8f2
commit 7bc3e74202
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
def is_palindrome(maybePalindrome):
for i in (range(0, int(len(maybePalindrome)/2))):
if maybePalindrome[i] != maybePalindrome[len(maybePalindrome) - i - 1]:
return False
return True
palindromeSum = 0
for i in range(1000000):
if is_palindrome(str(i)) and is_palindrome(str(bin(i))[2:]):
palindromeSum += i
print(palindromeSum)
print("The sum of all double base palindrome numbers below 1000000 is: ", palindromeSum)