I just starting with Python, been doing HTML, CSS, PHP and SQL for 8 years. Moving my way towards computer based programming.

Now that my past is out of the way, here is my problem.

Challenge # 4 on Euler, find the largest Palindrome number from the product of two 3-digit numbers. I did a flowchart, and I think it will work, but it's not printing anything. Here is my code:

- Code: Select all
`def ans_rev(ans):`

return int(str(ans)[::-1])

def main():

i = 9

while i <= 9 & i > 0:

a = 9

ans = a * i

pal = ans_rev(ans)

if ans == pal:

print(ans)

else:

print('. ')

i = i - 1

I was going to start small (1 digit numbers), and work my program up to 3-digit numbers. I know I will need to cycle a for when i reaches 0, but I know the largest here is (9 * 6 = 55). Question is, why doesn't it print anything? If I understand the why, I can solve for that problem.