Python program to Input a string and determine whether it is a palindrome or not | class 12 cbse computer science 083 new

Input a string and determine whether it is a palindrome or not

In this post I have shared python program about Input a string and determine whether it is a palindrome or not | Term I python practical for class 12 cbse computer science 083 new 

#2.Input a string and determine whether it is a palindrome or not.

Source Code

string=input("Enter any string:")

length=len(string)

mid=length//2

rev=-1

for a in range(mid):

     if string[a]==string[rev]:

          print(string,"is a palindrome.")

          break

     else:

          print(string,"is not a palindrome.")

Output

Sample output 1




Sample output 2







If you any doubts, Please let me know

Previous Post Next Post

Contact Form