Class 13 — Wednesday September 23

A dataset by any other name is still a dataset (but it is not a set)

In a loop, a loop — Nesting, but not like a bird — Repeating again


Look both ways


Agenda


Downloads


For the fun of it


Hacks of Kindness

To do list


Web pages

Our introduction to interacting with the web in CS 1112 is intentionally simple. Industrial-strength web applications also require familiarity with other and more powerful URL modules. There is an external library requests worth checking if you have further interest.

For now the only thing we is access to the module urllib.request. The module supports working with URLs.

import urllib.request

stream = urllib.request.urlopen( link )

page = stream.read()

text = page.decode( 'UTF-8' )

The above assignment sets text to be the decoded contents of the url resource named by link; that is text is a string equally the contents of the url resource indicted by ;ink.

import urllib.request # get module access

stream = urllib.request.urlopen( link ) # open connector to the link web resource

page = stream.read() # read contents of the resource

text = page.decode( 'UTF-8' ) # decode contents as normal text string


Program master_plan.py

???



Datasets


Program dataset_intro.py

Program run

table: [['A', 'B', 'C'], ['D', 'E', 'F'], ['G', 'H', 'I'], ['J', 'K', 'L', 'M']]

the table has 4 rows

row ['A', 'B', 'C'] has 3 columns

row ['D', 'E', 'F'] has 3 columns

row ['G', 'H', 'I'] has 3 columns

row ['J', 'K', 'L', 'M'] has 4 columns

row 0 : ['A', 'B', 'C']

row 1 : ['D', 'E', 'F']

row 2 : ['G', 'H', 'I']

row 3 : ['J', 'K', 'L', 'M']

row : A B C

row : D E F

row : G H I

row : J K L M

row 0 : ['A', 'B', 'C']

  column 0 of row 0 : A

  column 1 of row 0 : B

  column 2 of row 0 : C

row 1 : ['D', 'E', 'F']

  column 0 of row 1 : D

  column 1 of row 1 : E

  column 2 of row 1 : F

row 2 : ['G', 'H', 'I']

  column 0 of row 2 : G

  column 1 of row 2 : H

  column 2 of row 2 : I

row 3 : ['J', 'K', 'L', 'M']

  column 0 of row 3 : J

  column 1 of row 3 : K

  column 2 of row 3 : L

  column 3 of row 3 : M

row 0 : A B C

row 1 : D E F

row 2 : G H I

row 3 : J K L M

Enter column of interest: 1

Column 1 cell: B

Column 1 cell: E

Column 1 cell: H

Column 1 cell: K

Column 1 : ['B', 'E', 'H', 'K']




platypus licensed under creative commons (https://creativecommons.org/licenses/by-sa/2.0/)


Kingda Ka tower

 


  © 2020 Jim Cohoon   Resources from previous semesters are available.