📅  最后修改于: 2022-03-11 14:46:20.150000             🧑  作者: Mango
def is_palindrome(s):
#check if it's a string
if type(s) != str:
raise ValueError("This is not a string")
#return list of capital letters ignore other characters such as (, ! ? ...)
l1 = list(map(lambda x : x.isalpha and x.upper(), s))
#remove False from list
l1 = [x for x in l1 if x != False]
#reverse the previous list
l2 = list(reversed(l1))
# check is l1 equal to l2 ?
return l1 == l2
print(is_palindrome(input("Enter a string ")))