Score: 1; Reported for: Exact paragraph match
Open both answers

Present in both answers;
Present only in the new answer;
Present only in the old answer;

This is how I did it, not sure if it's the best answer but the most upvoted answer doesn't work properly:

tableData = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']]

def printTable(table): colWidths = [0] * len(table)

for i in range(len(table)): #for each list for j in range(len(table[i])): #for each word in the list if(len(table[i][j]) > colWidths[i]): #if longest word colWidths[i] = len(table[i][j]) #store new max len

for n in range(len(table[0])): # for len of each list (same size in spec) # print each column print(table[0][n].rjust(colWidths[0]), table[1][n].rjust(colWidths[1]), table[2][n].rjust(colWidths[2]))

printTable(tableData)

tableData = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']]

def printTable(table): colWidths = [0] * len(table)

for i in range(len(table)): #for each list for j in range(len(table[i])): #for each word in the list if(len(table[i][j]) > colWidths[i]): #if longest word colWidths[i] = len(table[i][j]) #store new max len

for n in range(len(table[0])): # for len of each list (same size in spec) # print each column print(table[0][n].rjust(colWidths[0]), table[1][n].rjust(colWidths[1]), table[2][n].rjust(colWidths[2]))

printTable(tableData)

Below is the code I used to find the longest string in the table and to print the table

tableData = [['apples', 'orange', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']]

def printTable(table): strName = '' maxLen = -1 # Find longest string in table for y in range(len(table[0])): for x in range(len(table)): strName = table[x][y] if len(strName) > maxLen: maxLen = len(strName) + 1 # Print table for y in range(len(table[0])): newTable = '' for x in range(len(table)): newTable = newTable + (table[x][y].ljust(maxLen)) print(newTable)

printTable(tableData) # Call function

tableData = [['apples', 'orange', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']]

def printTable(table): strName = '' maxLen = -1 # Find longest string in table for y in range(len(table[0])): for x in range(len(table)): strName = table[x][y] if len(strName) > maxLen: maxLen = len(strName) + 1 # Print table for y in range(len(table[0])): newTable = '' for x in range(len(table)): newTable = newTable + (table[x][y].ljust(maxLen)) print(newTable)

printTable(tableData) # Call function

Present in both answers;
Present only in the new answer;
Present only in the old answer;