comp.sci-python

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
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 -

    ¤¼¤»¤º

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. computer science

    I need to write a program that ask the student to enter an answer to a math problem. The user should enter two values, one at a time, and then ask for an answer. The program should display if the entered answer is correct or not and …
  2. Computers (Programming by Python)

    Problem 1: Multiplication Drill Computers can perform calculations extremely quickly and accurately, but it's often handy to calculate with the computers we carry around inside our heads. Write a program to drill you in multiplication …
  3. programming MIPS ask

    Write a MIPS assembly language program that will cover the following steps: Prompt the user to enter a first integer named i1 Prompt the user to enter a second integer named i2 Compute i1+i2-200 Print the value of the result Repeat …
  4. Javascript

    I'm trying to write a script that will allow a user to enter a year and then determine if the year is a leap year. I need to include a form with a single text box where the user can enter a year. I also need to display and alert dialog …
  5. computer science programming

    Elements – sequence-series outputting Write a program that prints the following elements: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, (hereto referred to as elements) etc., up till a user-entered value. The program should not print more than …
  6. Computer Programming

    Create the flowchart and algorithm for a module that will prompt the user to enter the amount of cash they have in their pocket. The program should output “Not Enough” ($0 - $0.64), “Vending Machine” ($0.65 - $1.99), “Fast …
  7. java programming

    Create a Sales application that prompts the user for a series of sales figures and then implements a sorting routine on the sales figures. Output. Enter the number of sales made today: 15 Enter the amount of sales 1:25 Enter the amount …
  8. java programming

    the learner is asked to write a program using java with user input that caculate and displays, the number of months it will take the user to save an amount of money. the user must enter the
  9. Computer Science/Pseudo Code Python

    Hi, I'm confused about an assignment. I'm not sure what to do and would like some help. An example: Write a program that obtains two integer numbers from the user. It will print out the sum of those numbers. Pseudo code: Prompt user …
  10. Ic

    Write an application that prompts the user for two integers and then prompts the user to enter an option as follows: 1 to add the two integers, 2 to subtract the second integer from the first, 3 to multiply the integers, and 4 to divide …

More Similar Questions