Please click on ads

Please click on ads

Sunday, 28 February 2021

palindrom by a loop in python

'''Write a program that reads a string from the user and uses a loop to determines whether or not it is a palindrome.
Display the result, including a meaningful output message. [A string is a palindrome if it is identical forward and backward.]'''
x = input('enter the string')

w = ''
for i in x:
w = i + w

if (x == w):
print("Yes")
else:
print("No")

No comments:

Post a Comment