Skip to content

Instantly share code, notes, and snippets.

@jhgaylor
Created June 28, 2012 04:06
Show Gist options
  • Select an option

  • Save jhgaylor/3008988 to your computer and use it in GitHub Desktop.

Select an option

Save jhgaylor/3008988 to your computer and use it in GitHub Desktop.
basically what you need
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