How to check if the given string is palindrome?
How to check if the given string is a palindrome? Looking for solutions in any language.
Nathan P.
answered 03/27/19
Experienced Software Engineer Who Teaches Programming
In Python you can do a couple of options
def is_palindrome(string):
character_length = len(string)
midpoint = character_length//2
for i in range(midpoint):
if string[i] != string[-i -1]:
return False
return True
def is_palindrome(string):
return string == string[::-1]
Still looking for help? Get the right answer, fast.
OR
Find an Online Tutor Now
Choose an expert and meet online.
No packages or subscriptions, pay only for the time you need.