str man plan canal Panama if str join reversed str print True else pri

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
str='A man, a plan, a canal: Panama'
if str == ''.join(reversed(str)):
print ('True')
else:
print ('False')
new_str='race a car'
if str == ''.join(reversed(new_str)):
print ('True')
else:
print ('False')
#in case I remove all punctuation and spaces, not sure that this one is correct
str='amanaplanacanalpanama'
if str == ''.join(reversed(str)):
print ('True')
else:
print ('False')