Returning result of palindrome program using while-loop
<pre><code>n = str(input('Enter the string:'))
def palindrome(n):
    index = 0
    check = True
    while index&lt;int(len(n)/2):
        if n[index]==n[-1-index]:
            index+=1
            return True
            break
        return False
if palindrome(n)==True:
    print('palindrome')
else:
    print('not palindrome')
</code></pre>

<p>I am not getting the correct answer for this palindrome program.</p>

<pre><code>while index &lt; int(len(n) / 2):
    if n[index] != n[len(n) - index - 1]:
        return False
    index+=1
return True
</code></pre>

python