""" Purpose: introductory take on examining a table of values """ # get access to web-based data support import url # set repository folder DATASET_FOLDER = "http://www.cs.virginia.edu/~cs1112/datasets/csv/" # get name of the dataset reply = input( "Enter name of dataset: " ) file_name = reply.strip() # specify link link = DATASET_FOLDER + file_name # get dataset table = url.get_dataset( link ) print( "table:", table ) print() # determine number of rows in table nrows = len( table ) print( "the table has", nrows, "rows" ) print() # print each row of the table along with its number of columns for row in table : ncols = len( row ) print( "row", row, "has", ncols, "columns" ) print() # print each row of the table using row indices for r in range( 0, nrows ) : row = table[ r ] print( "row", r, ":", row )