Difference between revisions of "CSC111 Homework 12"

From dftwiki3
Jump to: navigation, search
(Problem #2: Poem Generator)
Line 47: Line 47:
 
==Problem #2: Poem Generator==
 
==Problem #2: Poem Generator==
  
* This idea was submitted by Jack.
+
* This idea for this problem was submitted by Jack.
 +
 
 +
* The general idea is taken from http://thinkzone.wlonk.com/PoemGen/PoemGen.htm.  Take a look at it and see how it works.  Generate some poems.
 +
 
 +
* Implement the same idea in Python.
 +
 
 +
===Requirements===
 +
 
 +
* There are 9 groups of words:
 +
** concrete nouns : SEA SHIP SAIL WIND ... SUN
 +
** abstract nouns : ADVENTURE COURAGE ENDURANCE ...
 +
**                  ...
 +
** interjections : O OH OOH AH LORD GOD...
 +
* There are many difference sentence patterns, of the form:
 +
** THE 5 1 6 3S THE 1.
 +
** 5, 5 1S 6 3 A 5, 5 1.
 +
** 2 IS A 5 1.
 +
** ...
 +
** NEVER 3 A 1.
 +
 
  
 
 

Revision as of 15:28, 22 April 2010

No homework assignment this week.

The problems listed below are optional. Just write a program for one of the problem only. The grade you obtain will replace the lowest assignment grade you have gotten so far.

The due date is the same as for other homework assignments: next Thursday at midnight.

Problem #1: Where should you eat today?

This problem was suggested by Kristina.

Write a program that reads the Web page located at http://www.smith.edu/diningservices/10Menus/10apr22.php and that search for your favorite dishes. If it finds a house where your favorite dishes are offered, it displays the name of the house, and the menu for that house.

Here is an example of how your program should get its input. The user input is underlined.

 python hw12a.py

 Welcome to the Smith Menu Selection program.
 Today is April 22, 2010

 What are your favorite dishes? pasta icecream ROAST

 Your favorite dishes are offered today in:

 Chapin: Icecream
 Cutter-Ziskind: Icecream, Pot Roast
 Hubbard: Pasta Bar

Requirements

  • Your program must request only one thing from the user: a string of characters containing one or several words.
  • Your program figures out which day is today (see http://pleac.sourceforge.net/pleac_python/datesandtimes.html for ways of getting date information from the computer), and looks at the Web page for that day only. The day is coded in the URL of the Web page offering the menus.
  • Your program reports which house offers one of the words specified by the user in their menu, and displays that word and any accompanying word (for example, the user entered ROAST", and the program found "Pot Roast" in the menu offered at Cutter-Ziskind.


Submission

  • If you do this program, call it hw12a.py and submit it as:
   submit hw12 hw12a.py


Problem #2: Poem Generator

  • This idea for this problem was submitted by Jack.
  • Implement the same idea in Python.

Requirements

  • There are 9 groups of words:
    • concrete nouns : SEA SHIP SAIL WIND ... SUN
    • abstract nouns : ADVENTURE COURAGE ENDURANCE ...
    • ...
    • interjections : O OH OOH AH LORD GOD...
  • There are many difference sentence patterns, of the form:
    • THE 5 1 6 3S THE 1.
    • 5, 5 1S 6 3 A 5, 5 1.
    • 2 IS A 5 1.
    • ...
    • NEVER 3 A 1.