I need some more help. Basically, I'm trying to return the user input with all non-space and non-alphanumeric characters removed. I made code for this much of the way, but I keep getting errors...
def remove_punctuation(s):
'''(str) -> str
Return s with all non-space or non-alphanumeric
characters removed.
>>> remove_punctuation('a, b, c, 3!!')
'a b c 3'
'''
punctuation = '''''!()-[]{};:'"\,<>./?@#$%^&*_~'''
my_str = s
no_punct = ""
for char in my_str:
if char not in punctuation:
no_punct = no_punct + char
return(no_punct)
I'm not sure what I'm doing wrong. Any help is appreciated!
I guess that's will work for you !