As of now it takes the punctuation out, but I cannot figure out how to make it add a space instead of just taking out the punctuation. Currently I have:
punctuation = "!\"#$%&()*+,-./:;<=>?@[\\]^_`{|}~"
def remove_punct(theStr):
theStr_sans_punct = ""
for letter in theStr:
if letter not in punctuation:
theStr_sans_punct = theStr_sans_punct + letter
return theStr_sans_punct
It's in a interactive textbook so it will automatically do the tests on their site.