Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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 fun

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

What is the growth rate of GDP per capita?

Answered: 1 week ago