I had to make a few changes in your code to replicate the output you said you saw.
Ultimately, what you want is that the message be displayed only at the end of all the comparisons. In your case, you had it inside the loop, so each time the loop ran and it hit the if condition, the status message was printed. Instead, I have changed it so that it only prints when the two pointers index and p are at the middle of the word.
str = raw_inputinput("Enter the string: ") l = len(str) p = l-1 index = 0 while index < p: if str[index] == str[p]: index = index + 1 p = p-1 if index == p or index + 1 == p: print("String is a palindrome") else: print("string is not a palindrome") break