Skip to content

Instantly share code, notes, and snippets.

@lplume
Last active December 19, 2015 09:39
Show Gist options
  • Save lplume/5934912 to your computer and use it in GitHub Desktop.
Save lplume/5934912 to your computer and use it in GitHub Desktop.
italian palindrome sentence check (switch accent sugar)
import sys
# TODO: input like "a'a'"
f = sys.argv[1].replace(" ","").lower()
o = f.find("'")
if o > 0:
r = (f[:o-1]+f[o-1:o+1][::-1]+f[o+1:])
else:
r = f
print f == r[::-1]
import sys
f = [x for x in sys.argv[1] if x != "'" and x != ' ']
f == f[::-1]
@lplume
Copy link
Author

lplume commented Jul 5, 2013

thanks a lot! 2nd version updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment