code: def columnise(rows, padding=2):
      
      strs = []
      maxwidths = {}
  
      for row in rows:
          for i, e in enumerate(row):
              se = str(e)
              nse = len(se)
              w = maxwidths.get(i, -1)
              if nse > w:
                  maxwidths[i] = nse
  
      for row in rows:
          s = ''
          for i, e in enumerate(row):
              se = str(e)
              if i < len(row) - 1:
                  n = maxwidths[i] + padding - len(se)
                  se += ' ' * n
              s += se
          strs.append(s)
      return strs
docs: Print rows of entries in aligned columns.