Skip to content

Instantly share code, notes, and snippets.

@yuda110
Last active April 22, 2016 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuda110/24969406c508f57adfe1e9295ef82b4f to your computer and use it in GitHub Desktop.
Save yuda110/24969406c508f57adfe1e9295ef82b4f to your computer and use it in GitHub Desktop.
#python3
palindrome = []
def get_palindrome(num1, num2) :
max_palindrome = 0
num2_org = num2
while num1 > (num1/10) :
while num2 > (num2/10) :
multipled_num = num1*num2
if is_palindrome(multipled_num) and (max_palindrome < multipled_num):
max_palindrome = multipled_num
num2 -= 1
num1 -= 1
num2 = num2_org
return max_palindrome
def is_palindrome(num) :
if str(num) == str(num)[::-1] :
return True
else :
return False
print(get_palindrome(9999, 9999))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment