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>def palindrome(my_string):
    reverse_string = my_string[::-1]
    if list(my_string)==list(reverse_string):
       return True
    else:
       return False
my_string = input("ENTER THE STRING ")
if(palindrome(my_string)):
    print("Palindrome")
else:
    print("Not Palindrome")
</code></pre>

python