CSC111 Homework 9 2014

From dftwiki3
Revision as of 18:25, 2 April 2014 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- __TOC__ <br /> <bluebox> This program deals with text files, writing and reading files, and using Python to process files. </bluebox> <br /> =Problem #1= <br /> Wr...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut (talk) 18:25, 2 April 2014 (EDT)


Contents


This program deals with text files, writing and reading files, and using Python to process files.


Problem #1


Write a program that reformats text files and rewraps the text to a specified width.

Here is an example. Assume you have a text file called news.txt that contains this text (taken from Google news on 4/2/14):

Washington (CNN) -- If you're rich and want to give money to a lot of political

campaigns, the Supreme Court ruled Wednesday that you can. The 5-4 ruling eliminated limits on how much money people can donate in total in one election season. However, the decision left intact the current $5,200 limit on how much an individual can give to any single candidate during a two-year election cycle. Until now, an individual donor could give up to $123,200 per cycle.