Difference between revisions of "CSC111 Homework 9 2011"
(Created page with "--~~~~ ---- <center> <font size="+2">Page under construction!</font> <br \>300px </center> =Problem #1= * Write a program called hw9a.py that ou...") |
(→Problem #1) |
||
Line 9: | Line 9: | ||
=Problem #1= | =Problem #1= | ||
− | * Write a program called hw9a.py that outputs average length of the presidency of US presidents, categorized by party. Your program should get the information from a file called '''presidents.txt''', whose contents is available [[CSC111 presidents.txt| here]] | + | * Write a program called hw9a.py that outputs average length of the presidency of US presidents, categorized by party. Your program should get the information from a file called '''presidents.txt''', whose contents is available [[CSC111 presidents.txt| here]]. |
+ | |||
+ | :If you are working on beowulf, you can get a copy of the file into your account this way: | ||
+ | |||
+ | getcopy presidents.txt | ||
+ | |||
* The output of your program should look something like this: | * The output of your program should look something like this: | ||
Line 19: | Line 24: | ||
Others: x.xx years | Others: x.xx years | ||
− | * The number of presidents (44) should be the number found by your program in the text file. When I test your program, I may provide a '''presidents.txt''' file with fewer than 44. Or with no presidents at all! Be sure you test your program well! | + | * The number of presidents (44) should be the number found by your program in the text file. When I test your program, I may provide a '''presidents.txt''' file with fewer than 44 presidents. Or with no presidents at all! Be sure you test your program well! |
* Submit your program as follows: | * Submit your program as follows: |
Revision as of 12:32, 13 November 2011
--D. Thiebaut 12:28, 13 November 2011 (EST)
Problem #1
- Write a program called hw9a.py that outputs average length of the presidency of US presidents, categorized by party. Your program should get the information from a file called presidents.txt, whose contents is available here.
- If you are working on beowulf, you can get a copy of the file into your account this way:
getcopy presidents.txt
- The output of your program should look something like this:
Average length of presidency. 44 presidents Democratic presidents: x.xx years Republican presidents: x.xx years Others: x.xx years
- The number of presidents (44) should be the number found by your program in the text file. When I test your program, I may provide a presidents.txt file with fewer than 44 presidents. Or with no presidents at all! Be sure you test your program well!
- Submit your program as follows:
rsubmit hw7 hw7a.py
- if you worked on beowulf, or submit your program using this page: http://cs.smith.edu/~111a/submit9.html