# Author: James Tam # Version: May 28, 2020 MAX_ROWS = 2 MAX_COLUMNS = 5 # 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 = [] for r in range(0,MAX_ROWS,1): tempRow = ["*"] * MAX_COLUMNS aList.append(tempRow) return(aList) # 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): #Declare variables for function r = -1 c = -1 r = 0 # Each iteration of the outter loop accesses another row while (r < MAX_ROWS): c = 0 # Each iteration of the inner loop accesses another element along that row while (c < MAX_COLUMNS): #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 = createList() display(aList) start()