We are working on the Vigenere cipher in my computer science class and one of the first steps our teacher wants us to take is to delete all whitespace, punctuation, and capitalization from a string.
#pre-process - removing spaces, punctuation, and capitalization
def pre_process(s):
str = s.lower()
s = (str.replace(" ", "") + str.replace("!?'.", ""))
return s
print(pre_process("We're having a surprise birthday party for Eve!"))
What I want the output to be is "werehavingasurpisebirthdaypartyforeve"
but what I'm actually getting is "we'rehavingasurprisebirthdaypartyforeve!we're having a surprise birthday party for eve!"