HW 8

Download and save the file hw08.py to your cs100/hw folder. Additionally, you will need to save the following files in the same cs100/hw folder: rainfall.txt and loremipsum.txt

This file is a template. It contains some code there for you. Put your name at the top of the file. The questions are written in comments. Each question involves you implementing a function below it to solve a specific problem. If you run it without changes, you should see the following:

Running Q1: Rainfall data
Running Q2: Temperature conversion table
Running Q3: Uppercase file contents
Running Q4: File contents metrics

I suggest you work one question at a time. Each question is worth 2.5 points. Read the question description and write your solution. Before you move on, test that your solution is correct. When you have questions about the homework, are looking for ideas on how to start, etc., please join office hours for either of the zone interns.

Expected output

Your program will produce two different kinds of outputs: it will create and write files in your cs100/hw folder and it will also output to the shell/terminal. For clarity of reading, some of the output is omitted and is indicated so by ellipses (....).

Q1 saveRainfallData() output in the file outRainfall.txt:

                    Akron  25.8 
                    Albia  37.6 
                   Algona  30.7 
                  Allison  33.6 
                    Alton  27.4 
                    ....
           BurlingtonKBUR  37.9 
               Burlington  36.9 
                  Carroll  33.3 
                  Cascade  33.5 

Q2 temperatureConversion() output in the file outTemp.txt

 FARENHEIT    CELSIUS 
  -300.000   -184.444 
  -299.000   -183.889 
  -298.000   -183.333 
  -297.000   -182.778 
  -296.000   -182.222 
  -295.000   -181.667 
          ....
   206.000     96.667 
   207.000     97.222 
   208.000     97.778 
   209.000     98.333 
   210.000     98.889 
   211.000     99.444 
   212.000    100.000 

Q3 contentsToUppercase() output in the file outLOREMIPSUM.txt

LOREM IPSUM, OR LIPSUM AS IT IS SOMETIMES KNOWN, IS DUMMY TEXT USED 
IN LAYING OUT PRINT, GRAPHIC OR WEB DESIGNS. THE PASSAGE IS 
ATTRIBUTED TO AN UNKNOWN TYPESETTER IN THE 15TH CENTURY WHO IS 
THOUGHT TO HAVE SCRAMBLED PARTS OF CICERO'S DE FINIBUS BONORUM ET 
MALORUM FOR USE IN A TYPE SPECIMEN BOOK. IT USUALLY BEGINS WITH:

....

MCCLINTOCK'S EYE FOR DETAIL CERTAINLY HELPED NARROW THE WHEREABOUTS 
OF LOREM IPSUM'S ORIGIN, HOWEVER, THE “HOW AND WHEN” STILL REMAIN 
SOMETHING OF A MYSTERY, WITH COMPETING THEORIES AND TIMELINES. 

FOR MORE DETAILS, REFER TO HTTPS://LOREMIPSUM.IO/

Q4 fileContentMetrics() output in the shell/terminal in Thonny

Here is the expected output to the shell/terminal (in Thonny):

Running Q4: File contents metrics
lines: 68
words: 516
chars: 3315

Grading

You will be graded based on the quality of your code and that the output of each function matches the expected result. I will be checking to see that you correctly computed the solution programmatically. In order to receive any credit, your program must run without syntax errors in Thonny.

How to submit

Double check that your program runs without syntax errors. Submit the file hw08.py updated with your changes to Moodle. Do not submit any text files.