Last active
December 19, 2015 10:38
-
-
Save Caleb2501/5941422 to your computer and use it in GitHub Desktop.
Yay another challenge down! I had no idea that Demetri Martin had made this poem! pretty impressive.
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
# A Palindrome is a sequence that is the same in reverse as it is forward. | |
# I.e. hannah, 12321. | |
# Your task is to write a function to determine whether a given string is palindromic or not. | |
def palTest(string): | |
cleanLetters = [] | |
string = string.lower() | |
alpha = "abcdefghijklmnopqrstuvwxyz1234567890" | |
for i in string: | |
if i in alpha: | |
cleanLetters.append(i) | |
revLetters = cleanLetters | |
revLetters.reverse() | |
if cleanLetters == revLetters: | |
print "Yes this is a palindrome." | |
else: | |
print "Nope" | |
f = open('Martin.txt', 'r') | |
list1 = f.read() | |
palTest(list1) |
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
Dammit I’m mad. | |
Evil is a deed as I live. | |
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” | |
Evil is a deed as I live. | |
Dammit I’m mad. | |
Yes this is a palindrome. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment