please help me with a function printShorter
style="color:rgb(0,0,0);">() that takes a string phrase representing a phrase and an integer n as parameters and prints, one per line, the words in phrase that have length less than or equal to n. The phrase may have punctuation, and you must remove that puncutation before processing the phrase. For the purposes of this question, punctuation will only include an exclamation mark (!), a question mark (?), a comma (,), a period (.), a colon (:), and a semicolon (;). The words in the phrase are separated by whitespace, although you may not make any assumptions about what type or how much is present. You may print the words in any order. If n is less than or equal to 0, nothing will be printed to the screen. If phrase is empty, nothing will be printed to the screen.
>>>printShorter('Today is, a, sunny, day!!!', 3)
>>>printShorter('Today is, a, sunny, day!!!', 4)
>>>printShorter('Do! Your! Work!! And, things, will, work; out?', 5)
>>>printShorter('Today, is, a, sunny, day!!!', 0)
Recently Asked Questions
- In python, how do you create a function that is passed a tuple, then it uses recursion to find and return the minimum value in the tuple. All while not using
- Please refer to the attachment to answer this question. This question was created from CSC121_Project2.docx.
- I need help testing a class I made The class is : class Country : def __init__ ( self ,name,pop,area, continent) : self ._name = name self ._pop = pop self