Created
June 28, 2012 04:06
-
-
Save jhgaylor/3008988 to your computer and use it in GitHub Desktop.
basically what you need
This file contains hidden or 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
| myQueue = [] | |
| myString = "Tacocat" | |
| myString.toLower() | |
| for index,character in enumerate(myString): | |
| myQueue.append(myString[index]) | |
| myStack = myQueue.reverse() | |
| is_palindrome = True | |
| while True: | |
| stack_character = myStack.pop() | |
| queue_character = myQueue.pop() | |
| if not stack_character or not queue_character | |
| break | |
| if stack_character != queue_character: | |
| is_palindrome == False | |
| break | |
| if is_palindrome: | |
| print myString + " is a palindrome." | |
| else: | |
| print myString + " is not a palindrome." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment