''' Purpose: introductory take on examining a table of values ''' table = [ ["A", "B", "C" ], [ "D", "E", "F" ], [ "G", "H", "I" ], [ "J", "K", "L" ] ] # This is a dataset! A dataset is essentially a list of lists! It's a big list with a bunch of little lists inside. rows = 4 cols = 3 print( table ) # So what's our table? It's our list of lists! print() print() # The following for loop will print out each list within our list of lists on separate lines for element in table : print( element ) print() print() # This for loop will go through each row in our dataset (each list in our dataset) and go into each row which is indexing our list (getting the list at a number position) # It will take that row and print out the row index and the row (list in the dataset) for r in range( 0, rows ) : row = table[ r ] print( r, row ) print() print() # This loop goes through each r value and prints out the r value and row followed by going through the c loop for that r as well for r in range( 0, rows ) : row = table[ r ] print( r, row ) for c in range( 0, cols ) : cell = table[ r ][ c ] print( " ", r, c, cell ) print() print() # This loop goes through each r value and loops through the given c values for each # r value in the loop and prints the table cell on the same line before going to the next r for r in range( 0, rows ) : for c in range( 0, cols ) : cell = table[ r ][ c ] print( cell, end=" " ) print() print() print()