2017-05-01 Website HW 02,03,04

posted May 1, 2017, 6:23 AM by Samuel Konstantinovich   [ updated May 2, 2017, 7:56 AM ]

For html pages in directories 02,03, and 04, use the following website ( http://hilite.me/ ) to convert your python file to an HTML file. 

You input your python, and it outputs ugly HTML source!

Use this for 02 since you did that already, and you will also use it on  03 and 04.

Inside those directories create an extra html file  source.html and paste the results of the website.

For 02SAT, you will have 3 files:
02SAT/SAT2010.html  (run your python code on the 2010 data and paste the results)
02SAT/SAT2012.html  (run your python code on the 2012 data and paste the results)
02SAT/source.html     (the highlite.me version of your python code)

The website will create this:  (THIS WILL GO INTO source.html )
<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-style: italic">#Put</span>
<span style="color: #008800; font-style: italic">#your</span>
<span style="color: #008800; font-style: italic">#header</span>

<span style="color: #008800; font-style: italic">#include any functions you wrote</span>
<span style="color: #000080; font-weight: bold">def</span> function(a,b):
  <span style="color: #000080; font-weight: bold">return</span> a * b

<span style="color: #008800; font-style: italic">#YOU MUST include the code that you ran to generate the website.</span>
<span style="color: #000080; font-weight: bold">print</span> function(<span style="color: #0000FF">12</span>,<span style="color: #0000FF">30</span>)

Paste the output of the website into the BODY of your HTML file: source.html, it will look like this:

#include any functions you wrote
def function(a,b):
  return a * b

#YOU MUST include the code that you ran to generate the website.
print function(12,30)

Here are two easy web pages to work on:

LAB + HW due Wed 8am - includes 2 directories and 4 HTML files.

Remember capitalization is important, copy/paste the name of the file/folder to be safe.

1. Place the HTML files into the folder:  ~/public_html/03BigTable/output.html

For 03BigTable, you will have 2 files:
03BigTable/source.html  (the highlite.me version of your python code)
03BigTable/output.html   (run your python file and paste the results)
Your goal is to print a big table of numbers and words.

Write a python program that prints a webpage that looks like this: (the page should have 1,235 lines in the table.
 Number   Words
 0 zero
 1 one
 ... ...all the numbers in between...
 1234    one thousand two hundred and thirty-four
a) Put the output in output.html
b) Put the Formatted Source code in source.html

2. Place the html files into the folder:  ~/public_html/04ASCII/output.html 

For 04ASCII, you will have 2 files:
04ASCII/source.html   (the highlite.me version of your python code)
04ASCII/output.html   (run your python program and paste the results)
Your goal is to print out an HTML table that contains the ASCII table!.

This part is to help you think about the rest of the problem
Make  a function makeStars(rows,cols)
makeStars(3,4) will return a  3 row 4 column grid of stars:
makeStars(2,8) will return a  2 row 8 column grid of stars:

Now instead of printing stars, create the list of numbers 0 to N, where N is (rows * cols -1)
make an empty outer list and repeat for each row:
  Make a new list per row
  Append the values to that row
  append that row to the original list.

[[0, 1, 2, 3, 4], 
[5, 6, 7, 8, 9]]
[[0, 1, 2, 3],
[4, 5, 6, 7],
[8, 9, 10, 11]]

Finally the real problem: makeAsciiTable() will make a 6x16 grid (6 rows, 16 columns), that shows the values from 32 to 127
Hint: You can modify your makeNums to start at 16 instead of 0.

Now: Convert that list of numbers to an html table where each td looks like this:
<td>65 : 'A'</td>
<td>97 : 'a'</td>  
<td>98 : 'b'</td> 
etc.   (the number is converted to the char value)

This will include all of the values from 32-127. 
It should look like this: (no header)

65 :'A'66 :'B'67 :'C'68 :'D'69 :'E'70 :'F'71 :'G'72 :'H'73 :'I'74 :'J'75 :'K'76 :'L'77 :'M'78 :'N'79 :'O'80 :'P'
81 :'Q'82 :'R'83 :'S'84 :'T'85 :'U'86 :'V'87 :'W'88 :'X'89 :'Y'90 :'Z'91 :'['92 :'\'93 :']'94 :'^'95 :'_'96 :'`'