Created
July 27, 2017 16:50
-
-
Save rostyq/1403efae0ff157f88fdc5abc76502f7c to your computer and use it in GitHub Desktop.
Exercise on www.practicepython.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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