new file: problem_4.py

master
MitchellHansen 9 years ago
parent 6d6ae816eb
commit 85816782e0

@ -0,0 +1,24 @@
import math
def isPalindrome(number):
num_str = str(number)
if len(num_str) % 2 != 0:
return False
for i in range(0, int(len(num_str) / 2)):
if num_str[i] != num_str[len(num_str) - (i + 1)]:
return False
return True
largest_number = 0
for x in range(0, 999):
for y in range(0, 999):
if isPalindrome(x * y) and largest_number < x * y:
largest_number = x * y
print(largest_number)
Loading…
Cancel
Save