Question: helution removePunc takes a string containing letters, digits and punctuation and removes all the unctuation and returns a new string with no punctuation. The punctuation
helution removePunc takes a string containing letters, digits and punctuation and removes all the unctuation and returns a new string with no punctuation. The punctuation it removes is defined in the constant PUNC below. For example, if the work is "London's.", then the function would return "Londons". The code for this function is provided below with some code fragments missing. Examples of the execution of the code when correctly completed are also provided. A numbered list of code fragments (pieces of Python statements or Python lines of code) are provided. You are to complete the function by selecting the correct answer to the multiple choice question below and the next two multiple choice questions. Each question will give you a choice of fragments from which to choose. You are to choose the correct code fragment to complete the indicated missing fragment (e.g. "fragment #1"). PUNC = "..:;'"?!" def remove Punc (w): neww for ch fragment #1 : if ch fragment #2: neww fragment #3 return neww ** Main Program xl - "Ab: 123!" x2 - "a,.,.,b?" print (remove Punc (xl)) print (remove Punc (x2)) Output from main when remove Pune is correctly completed and executed. Ab123 Output from main when remove Punc is correctly completed and executed. Ab123 ab Which of the following code fragments would complete fragment #1? List of code fragments 1. neww + ch 2. neww - PUNC 3. W- PUNC 4. W 5. ch 6. in w 7. in new 8 - PUNC 9. in PUNC 10. not in PUNC 11. not in neww 12. not in w 13. PUNC A 10 B.9 . 7 0.6 E B Beset Selection
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
