Python Moment: Is ‘Never Odd or Even’ a Palindrome?

Palindrome Word PyramidQuick little geek-out here: Had some initial fun with Python string manipulations in order to detect a palindrome, defined here as a word or phrase (perhaps a very long phrase) spelled the same when reversed as when forward.  Had to dig just a bit deeper to accommodate any blank spaces that would otherwise violate the rule.  The link to my code is here in GitHub.

Teasers:  Is “Never Odd or Even” a Palindrome? This Python code (in v2) solves it  What about “Was it a car or a cat I saw”?  Solves this, too.  Finally, if you’re wondering why one would write code to solve this, rather than eye-balling it, consider this next one…

God, am I reviled? I rise, my bed on a sun, I melt.  To be not one man emanating is sad. I piss.  Alas, it is so late. Who stops to help?  Man, it is hot. I’m in it. I tell.  I am not a devil. I level “Mad Dog”.  Ah, say burning is, as a deified gulp, In my halo of a mired rum tin.  I erase many men. Oh, to be man, a sin.  Is evil in a clam? In a trap?  No. It is open. On it I was stuck.  Rats peed on hope. Elsewhere dips a web.  Be still if I fill its ebb.  Ew, a spider… eh?  We sleep. Oh no!  Deep, stark cuts saw it in one position.  Part animal, can I live? Sin is a name.  Both, one… my names are in it.  Murder? I’m a fool.  A hymn I plug, deified as a sign in ruby ash, A Goddam level I lived at. On mail let it in. I’m it.  Oh, sit in ample hot spots. Oh wet!  A loss it is alas (sip). I’d assign it a name.  Name not one bottle minus an ode by me:  “Sir, I deliver. I’m a dog”

If we agree that a palindrome can ignore any non-letters (punctuation), is it a palindrome?  You’d definitely want to answer ones like this programmatically, right?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s