Post a New Question


posted by .

For this option, first ask the user what the maximum number of columns for printing will be. ("How wide should
the output be?") Next, the user will enter in a paragraph of text. They may enter it in as many lines as they'd like, and the only way you know they are done typing is that they will enter a completely blank line. Once you have all the output, you can assemble it into the output: each "word" should either fit on the current line within the maximum number of columns, or else you must put the word on the next line and fill the current line with spaces up to the given width.
• a "word" means anything between spaces. he's...multi-­‐tasking
on "Sunday" has five words.
• words at the end of one line and the beginning of the next must stay separate words (even though you
might not receive a space at the end of the first or beginning of the second line).
• multiple spaces should be replaced with a single space.
• tabs should be treated like space characters.
• place vertical bars on both edges of the text. They do not count towards the max width, but make it
clearer where the border of your document is.
• if a word cannot fit on a line at all, then put as much as you can on the line while still putting a hyphen as the last character on that line, and then continue with the rest of the word on the next
• Modify your word-wrap option so that instead of having the user enter in the text directly, they enter the filename of the text file where the contents should be found. This will allow for
multiple paragraphs; preserve each empty line as a full-width line.

  • comp.sci-python -


Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

More Related Questions

Post a New Question