if you can think of maybe a better way to do this (while still using stacks, it's for a class so i have to use stacks) i would love to hear any better ways thank you!!
here is my code:
from stack import Stack stack = Stack() stack2 = Stack() def palindromeChecker(phrase): for ch in phrase: if 'A'<=ch<='Z' or 'a'<=ch<='z' or '16'<=ch<='25': stack.push(ch) for letters in phrase: if 'A'<=letters<='Z' or 'a'<=letters<='z' or '16'<=leters<='25': stack2.push(letters) stack2.reverse()

New Topic/Question
Reply




MultiQuote









|