Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer in python. Write an iterative function remove Pun () which removes the following punctuations (,,,,?,,!, ;,,:) from a given string and returns a
Please answer in python.
Write an iterative function remove Pun () which removes the following punctuations (",,",","?,",!", ";,",:") from a given string and returns a string which does not include the given punctuation characters. Use a for loop to traverse through the collection (i.e. the string), if any element of the string is a character in the parenthesis (.,;:? !) then remove it from the list. To do this you will need to create a new string and initialise it to an empty string outside the for loop. During traversal if a punctuation character is in the collection then don't add it to the new string, all other items are included in the new string. Note: To check if a given character is any one of the following (",, ,",", "?,", "!, ,",", ":"), you can use the following statement; ifcin(",",".","?","!",";,":") removePun("COMP1126!! is a, : lot of, fun?") 'COMP1126 is a lot of funStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started