# Author: James Tam # Version: May 28, 2020 # args(none) # Creates a 2D list with num rows = 1st argument, num columns = 2nd argument # return (reference to the list, integer,integer) def createList(): #Declare variables for function aList = [] numRows = -1 numColumns = -1 aList = [ [" "," ", " "], ["*"," ", "*"], [" ","|", " "], [" "," ", ""], ["*","*", "*"] ] numRows = len(aList) numColumns = len(aList[0]) return(aList,numRows,numColumns) # args(reference to a list,integer,integer) # displays each element of list with a row on it's own line # return(nothing) def display(aList,numRows,numColumns): #Declare variables for function r = -1 c = -1 r = 0 # Each iteration of the outter loop accesses another row while (r < numRows): c = 0 # Each iteration of the inner loop accesses another element along that row while (c < numColumns): #Display each element along a row on the same line print("%s" %(aList[r][c]),end="") c = c + 1 print("") #After each row printed add a new line (EOL) r = r + 1 #Starting execution point for the program def start(): #Declare variables local to start aList = [] numRows = -1 numColumns = -1 aList,numRows,numColumns = createList() display(aList,numRows,numColumns) start()