please help me with a function printShorter () that takes a string phrase representing a phrase and an integer n as parameters and prints , one per
View the step-by-step solution to:

Question

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)

is

a

day

>>>printShorter('Today is, a, sunny, day!!!', 4)

is

a

day

>>>printShorter('Do! Your! Work!! And, things, will, work; out?', 5)

Do

Your

Work

And

will

work

out

>>>printShort('', 3)

>>>printShorter('Today, is, a, sunny, day!!!', 0)

>>>

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes