Skip to content

Instantly share code, notes, and snippets.

@rostyq
Created July 27, 2017 16:50
Show Gist options
  • Save rostyq/1403efae0ff157f88fdc5abc76502f7c to your computer and use it in GitHub Desktop.
Save rostyq/1403efae0ff157f88fdc5abc76502f7c to your computer and use it in GitHub Desktop.
while True:
something = input('Input text("exit" to break): ')
if something == 'exit':
break
# exceptions
restricted_symbols = [' ', '!', '.',
'?', ',', '_',
'$', '#', '@',
'"', "'", ':',
';', '`', '*',
'(', ')', '%',
'-', '--', '---']
new_something = [s for s in something if s not in restricted_symbols]
new_something = ''.join(new_something).lower()
if new_something == new_something[::-1]:
print('Input text is palindrome.')
else:
print('Input text is not palindrome.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment