Class 14 — Friday September 27
Web chrestomathics
An optimist thinks — Elevator close button — Really does something
Look both ways
Agenda
- Web input acquisition
To do list
- Review class artifacts.
- Do homework.
Downloads
- Program master_plan.py
- Program secret_revealed.py
- Program paging_page.py
- Program get_a_dataset.py
- Module url.py
Best sellers
- How many of these books have you read?
CS 1112 CSV datasets
- Primary examples
Examples
- Program master_plan.py
- Displays the word of the day from the CS 1112 web file
word-of-the-day
???
- Program secret_revealed.py
- Determines the superpower associated with a user-suppled computing id.
- Two possible program runs
Enter computing id: mst3k
Thanato-anno cognition
Enter computing id: jpc
Thermal obtusion
- Program paging_page.py
- Displays the contents of user-indicated web page
- Three possible program runs
Enter url: http://www.cs.virginia.edu/~cs1112/words/most-misspelled
appreciate
beautiful
cancelled
definitely
desert
diarrhea
gray
leprechaun
maintenance
neighbor
pneumonia
vacuum
Enter url: http://www.cs.virginia.edu/~cs1112/words/hangman
abated
abhors
ablush
abrade
...
zenith
zephyr
zipper
zombie
Enter url: http://www.virginia.edu/
Enter url: http://www.virginia.edu
<!DOCTYPE html>
<!--[if IEMobile 7]><html class="no-js ie iem7" lang="en" dir="ltr"><![endif]-->
<!--[if lte IE 6]><html class="no-js ie lt-ie9 lt-ie8 lt-ie7" lang="en" dir="ltr"><![endif]-->
<!--[if (IE 7)&(!IEMobile)]><html class="no-js ie lt-ie9 lt-ie8" lang="en" dir="ltr"><![endif]-->
<!--[if IE 8]><html class="no-js ie lt-ie9" lang="en" dir="ltr"><![endif]-->
<!--[if (gte IE 9)|(gt IEMobile 7)]><html class="no-js ie" lang="en" dir="ltr" prefix="fb: http://ogp.me/ns/fb# og: http://ogp.me/ns# article: http://ogp.me/ns/article# book: http://ogp.me/ns/book# profile: http://ogp.me/ns/profile# video: http://ogp.me/ns/video# product: http://ogp.me/ns/product#"><![endif]-->
<!--[if !IE]><!--><html class="no-js" lang="en" dir="ltr" prefix="fb: http://ogp.me/ns/fb# og: http://ogp.me/ns# article: http://ogp.me/ns/article# book: http://ogp.me/ns/book# profile: http://ogp.me/ns/profile# video: http://ogp.me/ns/video# product: http://ogp.me/ns/product#"><!--<![endif]-->
<head>
<meta charset="utf-8" />
...
- Program get_a_dataset.py
- Get a user-specified web csv resource as a Python dataset
- Two program runs
Enter name of dataset: best-sellers.csv
['Name', 'Author', 'Language', 'Date', 'Sales']
['Don Quixote', 'de Cervantes', 'Spanish', '1605', '500000000']
['A Tale of Two Cities', 'Dickens', 'English', '1859', '200000000']
['The Lord of the Rings', 'Tolkien', 'English', '1954', '150000000']
['The Little Prince', 'de Saint-Exupery', 'French', '1943', '140000000']
["Harry Potter and the Philosopher's Stone", 'Rowling', 'English', '1997', '120000000']
['The Hobbit', 'Tolkien', 'English', '1937', '100000000']
['And Then There Were None', 'Christie', 'English', '1939', '100000000']
['Dream of the Red Chamber', 'Xueqin', 'Chinese', '1754', '100000000']
["Alice's Adventures in Wonderland", 'Carroll', 'English', '1865', '100000000']
Enter name of dataset: rows_of_stuff.csv
['Asta', 'Hachiko', 'Laika', 'Lassie']
['59.0', 'TruE']
['faLse', '3.14', '271']
['01', '10', '10.0', 'ABC']
['Asta', 'Hachiko', 'Laika', 'Lassie']
[59.0, True]
[False, 3.14, 271]
[1, 10, 10.0, 'ABC']
© 2019 Jim Cohoon | Resources from previous semesters are available. |