From 3f7e8ccf77fbabcca4a395ef5e157f8cb5978a65 Mon Sep 17 00:00:00 2001 From: Chetanverma93 <66515815+Chetanverma93@users.noreply.github.com> Date: Sat, 3 Oct 2020 13:21:55 +0530 Subject: [PATCH] Create Removepunctuation --- Removepunctuation | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Removepunctuation diff --git a/Removepunctuation b/Removepunctuation new file mode 100644 index 0000000..a1e750a --- /dev/null +++ b/Removepunctuation @@ -0,0 +1,16 @@ +# define punctuation +punctuations = '''!()-[]{};:'"\,<>./?@#$%^&*_~''' + +my_str = "Hello!!!, he said ---and went." + +# 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)