Finished 36, was really easy

This commit is contained in:
2021-02-23 16:33:00 +01:00
parent 5f9bb74434
commit 2726c2d2ca

View File

@@ -9,11 +9,21 @@ Find the sum of all numbers, less than one million, which are palindromic in bas
def isPalindrome(n):
return n == int(str(n)[::-1])
def makeBinary(n):
return int(bin(n)[2:])
def main():
print("Hello this is Patrick")
for n in range(1000000):
print(makeBinary(8))
summand = 0
for n in range(1000000):
if isPalindrome(n) and isPalindrome(makeBinary(n)):
summand += n
print(summand)
if __name__ == "__main__":
main()