Hi I was wondering if someone could help me to figure out how to write a code for :
Write a function print_table which consumes two parameters, a list of list of strings,
and an integer for the length of the list. The function should print out the strings from
each sublist on each line. Commas and spaces are used to separate strings on the same
line. If the list is empty, then an empty string will be printed out. You may use the
above defined function print_row as helper function.
As an example, if the input list is defined as [[”Jack”, ”Smith”, ”CS”, ”ON”], [”
Alice”, ”Adam”, ”Math”, ”SK”], [”Jean”, ”Guy”, ”PHY”, ”QC”], [”Kim”, ”King
”, ”ENGL”, ”NS”]], the function should have the following printed out,
Jack, Smith, CS, ON
Alice, Adam, Math, SK
Jean, Guy, PHY, QC
Kim, King, ENGL, NS
I did manage to write the code for the print_row function:
x= ' '
if len(l) > 1 :
s = s + l + ', '
return s + l
oh, and we are suppose to use lambda, and abstract list functions if we can. thanks, ^^