Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Specification: You are to put the code for the function printTable () into the file tableprinter.py The function printTable (L) that takes a list L

image text in transcribed

Specification: You are to put the code for the function printTable () into the file tableprinter.py The function printTable (L) that takes a list L of lists of strings and displays it in a well organized table with each column right-justified. Assume that all the inner lists will contain the same number of strings. Given tableData = [ [ ' apples ' , ' oranges ' , ' cherries' , ' banana ' ] , [ 'AliceBob', "Carol', 'David'], [ 'dogs', "cats', "moose goose' 11 the function should print the following: apples Alice dogs oranges Bob cats cherries Carol moose banana David goose Hint: Your code will first have to find the longest string in each of the inner lists so that the whole column can be wide enough to fit all the strings. You can store the maximum width of each column as a list of integers. These widths will be used with the string method rjust to attain the desired alignment

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions