You are viewing a single comment's thread. Return to all comments →
def palindrome(s): if s==s[::-1]: return True else: return False def palindromeIndex(s): if s==s[::-1]: return -1 else: for i in range(len(s)//2): a=i b=len(s)-i-1 if s[a]!=s[b]: ns=s[:a]+s[a+1:] ns2=s[:b]+s[b+1:] if palindrome(ns): return a if palindrome(ns2): return b
Seems like cookies are disabled on this browser, please enable them to open this website
Palindrome Index
You are viewing a single comment's thread. Return to all comments →