Answer the question
In order to leave comments, you need to log in
Why doesn't palindrome search work?
Hello, I wrote a Python code to search for a palindrome, I don’t understand why it doesn’t display the correct results for me
Code:
p=0
for i in range(100,1000):
for j in range(100,1000):
p=i*j
p=str(p)
if p[:] == p[::-1]:
print(p)
Answer the question
In order to leave comments, you need to log in
Indents.
p = 0
for i in range(100, 1000):
for j in range(100, 1000):
p = i * j
p = str(p)
if p[:] == p[::-1]:
print(p)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question