Our Office
Ernakulam, Kottayam
Email Us
linusfacts@gmail.com
Call Us
+91 9544409513
1. Ask the user for a string.<br>2. Determine whether it's a palindrome (reads the same backward as forward). Example: kayak, madam and racecar are palindromes but hello and python are not. For simplicity, you can assume the string has no spaces or punctuation. You can’t use string[::-1] == string_ to check if the word is a palindrome.

QUESTIONS

1. Ask the user for a string.
2. Determine whether it's a palindrome (reads the same backward as forward). Example: kayak, madam and racecar are palindromes but hello and python are not. For simplicity, you can assume the string has no spaces or punctuation. You can’t use string[::-1] == string_ to check if the word is a palindrome.

Right Answer:


string=input("Enter a string value"
length=len(string)
for i in range(length):
if string[i] != string[-i-1]:
print("Not a palindrome")
break
else:
# This part is executed if the loop completes without breaking
print("It's a palindrome")
break

Get In Touch

Kochi, Pala,Ernakulam

+91 9544409513

linuslearning.in@gmail.com

Our Courses
Newsletter

Those people who develop the ability to continuously acquire new and better forms of knowledge that they can apply to their work and to their lives will be the movers and shakers in our society for the indefinite future