2018-04-25 HW

posted Apr 25, 2018, 6:10 AM by Konstantinovich Samuel   [ updated Apr 25, 2018, 10:06 AM ]
 Homework: 
Vote on the 15 different websites (rate each one from 1-5, and give a 6 to whichever you think is the best)
https://goo.gl/forms/VYuOsyutL5iPudeo1


Goal: Some madlibs experiments.

1. Make a python file that prints out an HTML page. Start with an entire blank webpage. 
hint: You can copy/paste the header into a multi-line string like this:
header = '''<html>
    <body>'''

foot = '''
    </body>
</html>'''

def generateBody():
    #do stuff
    return a_body_string

print header
print generateBody()
print foot

2. Take the story excepts below, and edit them manually.

Store the story excepts in string variables, and then:
Replace some nouns with $NOUN$
Replace some adjectives with $ADJECTIVE$
You can do this with verbs / adverbs / ProperNouns as well!

So you would create something like this:
"Call me Ishmael. Some years ago- never mind how long precisely- having little or no $NOUN$ in my $NOUN$, and nothing particular to interest me on shore, I thought I would $VERB$ about a little and see the watery part of the $NOUN$."

3. Take your words lists from your sentence generator and replace!

Replease EACH OCCURANCE of $NOUN$ with a different random noun. (there can be duplicates, but they should not all be the same)
Do this for all of the other word types as well!

4. Run it a few times!

Make sure the HTML is formatted nicely with tabs/newlines. 

Make sure the Rendered webpage looks good too!

5. Apply some style to the replaced words. 

Each replaced word should have some style to make it look different from the normal words. Try:

a) some color
b) a monospace font
c) slightly larger size

pick a tag {
    color: ????;

    font-size: ???;

    font-family: ???;
}

6. Style the entire site in a subtle way. 

a)Light background color 

b)Dark default text color. 

c)Some reasonable font (experiment)

Bonus: Fonts can be too rare to use! Use fonts that are common:

7. Final Goal: (due Friday Morning)
Put 3 versions of your story in the following file names:
~/public_html/03MadlibsLight/madlibs1.html
~/public_html/03MadlibsLight/madlibs2.html
~/public_html/03MadlibsLight/madlibs3.html

Three story excerpts:

Call me Ishmael. Some years ago- never mind how long precisely- having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking people's hats off- then, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball.

----

The studio was filled with the rich odour of roses, and when the light summer wind stirred amidst the trees of the garden, there came through the open door the heavy scent of the lilac, or the more delicate perfume of the pink-flowering thorn. 

From the corner of the divan of Persian saddle-bags on which he was lying, smoking, as was his custom, innumerable cigarettes, Lord Henry Wotton could just catch the gleam of the honey-sweet and honey-coloured blossoms of a laburnum, whose tremulous branches seemed hardly able to bear the burden of a beauty so flamelike as theirs; and now and then the fantastic shadows of birds in flight flitted across the long tussore-silk curtains that were stretched in front of the huge window, producing a kind of momentary Japanese effect, and making him think of those pallid, jade-faced painters of Tokyo who, through the medium of an art that is necessarily immobile, seek to convey the sense of swiftness and motion. The sullen murmur of the bees shouldering their way through the long unmown grass, or circling with monotonous insistence round the dusty gilt horns of the straggling woodbine, seemed to make the stillness more oppressive. The dim roar of London was like the bourdon note of a distant organ.

---

'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe: 
All mimsy were the borogoves, 
And the mome raths outgrabe.

"Beware the Jabberwock, my son! 
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun 
The frumious Bandersnatch!" 

He took his vorpal sword in hand; 
Long time the manxome foe he sought-
So rested he by the Tumtum tree 
And stood awhile in thought. 


Comments