Reputation: 568
Hello here is my python code:
def is_palindrome(nombre):
if str(nombre) == str(nombre)[::-1]:
return True
return False
x = 0
for i in range(100, 1000):
for j in range(i, 1000):
for z in range(j, 1000):
produit = i*j*z
if is_palindrome(produit):
if produit > x:
x = produit
print(x)
When I tried to compile this code I have got that error: produit = ijz ^ IndentationError: unindent does not match any outer indentation level Anyone has an idea please??
Upvotes: 1
Views: 14054
Reputation: 607
You can check for problems with tabs/spaces also in command line:
python -m tabnanny -v yourfile.py
Upvotes: 3
Reputation: 44838
The code in your question is a mess. Here's how it could probably look like with the indentation fixed.
def is_palindrome(nombre):
if str(nombre) == str(nombre)[::-1]:
return True
return False
x = 0
for i in range(100, 1000):
for j in range(i, 1000):
for z in range(j, 1000):
produit = i*j*z
if is_palindrome(produit):
if produit > x:
x = produit
# you may want to move this into the inner `if` statement
print(x)
Upvotes: 1