125. Valid Palindrome in Python3

Photo by Raphael Schaller on Unsplash
//determine if our all letters of our input are alphanumeric
// if alphanumeric then we change them to lower case
// keep our output in a place for comparison
-reverse the test
-if the forward test and backwards test match, return true
-else return false
def isPalindrome(self, s:str)
test=[]
for i in s:
def isPalindrome(self, s:str)
test=[]
for i in s:
if i.isalnum() == True:
def isPalindrome(self, s:str)
test=[]
for i in s:
if i.isalnum() == True:
test.append(i.lower())
def isPalindrome(self, s:str)
test=[]
for i in s:
if i.isalnum() == True:
test.append(i.lower())
revtest = test[::-1]
def isPalindrome(self, s:str)
test=[]
for i in s:
if i.isalnum() == True:
test.append(i.lower())
revtest = test[::-1]
if(test == revtest):
return True
else:
return False

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Melissa Guachun

Software Developer and visual artist based in NYC. Join me on my journey to coding enlightenment or a torrential mental breakdown, whichever comes first.