I'm again working on Project Euler, this time problem #4. The point of this script is to find the largest palindromic product of two three digit numbers. I thought it was fairly straightforward to solve, but I'm getting an answer that is too low. More specifically, I am getting 580085, and the answer is 906609.
Could someone tell me what about this is incorrect?
#!/usr/bin/env python
# encoding: utf-8
"""
P4.py
Created by Andrew Levenson on 2010-06-29.
Copyright (c) 2010 __MyCompanyName__. All rights reserved.
"""
import sys
import os
def main():
for x in range(100, 1000):
for y in range(100, 1000):
z = str( x * y )
s = str( z[::-1] ) # Reverse z
if z == s:
t = z
print t
if __name__ == '__main__':
main()