feat(solution): problem #36
parent
1438f0d8f2
commit
7bc3e74202
|
|
@ -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)
|
||||||
Loading…
Reference in New Issue