Posted by seema on Monday, October 29, 2012 at 11:03pm.
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
line.
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 - Anonymous, Sunday, November 4, 2012 at 5:08pm
ĪžĪŧĪš
Answer this Question
Related Questions
python 3 - For this option, first ask the user how many items there will be. (&...
computer science - Python 3 For this option, you will first ask "how many ...
comp sci - hi i am using java to make a quiz... i am using JFrame and have radio...
CIS - I have the pseudocode but i am confused with this question. Modify the Pay...
Programming in c++ - Write a program in c++ that inputs a number [1-12] from the...
devry - A small startup software developer company needs to create a program ...
computers - How can i tell python to stop printing something after a specific ...
programing - small startup software developer company needs to create a program...
computer programming - small startup software developer company needs to create ...
Computers (Java) - Hello -- Looking for help with an extra credit assignment to ...
For Further Reading