The aim of the code is to go through a string using a for loop and remove certain punctuations specifically (“,”,“.”,“?”,“!”, “;”,“:”) with the statement if c in (“,”,“.”,“?”,“!”, “;”,“:”)
included. So for I have tried using stringting.replace(stringting[i],"")
in the 5th line of the code below and then I tried using stringting.translate()
in line 5 with no luck. Why is it not working?
def removePun(stringting):
new_string = ""
for i in range (0,len(stringting)):
if stringting[i] in (",",".","","?",";",":"):
new_string = stringting.translate({ord(stringting[i]): None})
return new_string