Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- def isPalindrome(s):
- s=s.lower()
- string.punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
- for p in string.punctuation:
- if p in s:
- s = s.replace(p, '')
- return s == s[::-1]
- def check_tests(list):
- i =0
- answ = []
- is_palindrom = ' is palindrom'
- not_palindrom = ' is not palindrom'
- while(i<len(list)):
- str = '{} of example:'.format(i)
- if(isPalindrome(list[i])):
- str = str + is_palindrom
- else:
- str = str + not_palindrom
- answ.append(str)
- i +=1
- return answ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement