Solution:
Hello Gavin.
I hope you are doing great today. It’s nice to someone asked a question in a polite way and briefly.
I’ve snippet a program below and tried to make it as simple as possible for your better understanding.
# define punctuation
punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~'''
my_str = "Hello!!!, My name --- is Gavin."
# To take input from the user
# my_str = input("Enter a string: ")
# remove punctuation from the string
no_punct = ""
for char in my_str:
if char not in punctuations:
no_punct = no_punct + char
# display the unpunctuated string
print(no_punct)
This basic program will remove all the punctuations from a String. It will check each and every character of a string inside the for loop If it founds a punctuation an empty string will be assigned to it.
In this way, every punction will be removed from our string.
Thanks