2017-04-28 CSV to HTML - HW

posted Apr 28, 2017, 6:55 AM by Samuel Konstantinovich   [ updated Apr 28, 2017, 8:03 AM ]
Your python programs can output HTML.

We can write a python program that prints a valid (includes proper HTML skeleton) blank website (the body is empty).

BODY = "Something here"

print """<!DOCTYPE html><html>
<head><title>"""+TITLE +"""</title></head>

""" +  BODY + """


Notice that you can use variables in your HTML string that make it easy to replace segments of your website.

Write a python function that converts a 2D list, into an html table. 
L = ['a','b','c','d'], [1,2,3,12], ['fa','bu','lo','us'] ]
toHTMLTable( L ) 
Would return the string:

   <th>a</th> <th>b</th> <th>c</th> <th>d</th> 
   <td>1</td> <td>2</td> <td>3</td> <td>12</td> 
   <td>fa</td> <td>bu</td> <td>lo</td> <td>us</td> 

-If you could ask for a built in function to help you with this task , what would that function be?
-Is there a repeated non-trivial task in this problem that would be best put into a helper function?

a) Write the helper function first
b) Write the toHTMLTable() function using that helper method.

Goal 2 - Homework due Tuesday May 2nd 8am. 

2010 SAT results:
2012 SAT results:

1 Export these as a CSV. 
2 Read the data into python. Don't forget to include your header on this assignment!
3 Split it up appropriately.
4 Add a new column! "Total Score", and calculate the total score for each row of the data.
5 Convert the to an HTML table.
6 Output a complete website with your name on top and the SAT stats in an HTML table. Do this to both CSV files and output the text to SAT2010.html, SAT2012.html.
7. Place the html files into the folder:  ~/public_html/02SAT/ 
( ~ means your home directory)