Syllabus 2010 t2 p2

From XPUB & Lens-Based wiki

Problem Set 2.2

1. Palindrome Headlines

Transform the headlines of a newsfeed into palindromes. For example:

   "Green energy costs fall"
   would become:
   "Green energy costs fall costs energy Green"

2. Web Comics

a.

Take a web page, and automatically make a new webpage with only the images from the original web page. (Extracting image tags using html5lib)

Hint: Use the code from PythonHtml5lib to help you here!

b.

Take two web pages and create a "comic book" by alternating images from the two sources. (Hint: using the "height" attribute on the tag can be a quick way to make different sized images appear with the same height).

3. Total-ly Wast-ed

Take a Gutenberg text and create a new text made up of pairs where the first word ends in "ly" and the second ends in "ed". Some examples then:

totally wasted
finally visited
frankly toasted


Use regular expressions to accomplish this.

Support

Check the cookbook for support! Especially the List Basics page.

Results

Post your code and results and link them from here...