Print a nicely formated table from a list of (name, shares, price, change) tuples.
(reportdata, formatter)
| 38 | return rows |
| 39 | |
| 40 | def print_report(reportdata, formatter): |
| 41 | ''' |
| 42 | Print a nicely formated table from a list of (name, shares, price, change) tuples. |
| 43 | ''' |
| 44 | formatter.headings(['Name','Shares','Price','Change']) |
| 45 | for name, shares, price, change in reportdata: |
| 46 | rowdata = [ name, str(shares), f'{price:0.2f}', f'{change:0.2f}' ] |
| 47 | formatter.row(rowdata) |
| 48 | |
| 49 | def portfolio_report(portfoliofile, pricefile, fmt='txt'): |
| 50 | ''' |
no test coverage detected