MCPcopy Create free account
hub / github.com/dabeaz-course/practical-python / print_report

Function print_report

Solutions/3_18/report.py:33–41  ·  view source on GitHub ↗

Print a nicely formated table from a list of (name, shares, price, change) tuples.

(reportdata)

Source from the content-addressed store, hash-verified

31 return rows
32
33def print_report(reportdata):
34 '''
35 Print a nicely formated table from a list of (name, shares, price, change) tuples.
36 '''
37 headers = ('Name','Shares','Price','Change')
38 print('%10s %10s %10s %10s' % headers)
39 print(('-'*10 + ' ')*len(headers))
40 for row in reportdata:
41 print('%10s %10d %10.2f %10.2f' % row)
42
43def portfolio_report(portfoliofile, pricefile):
44 '''

Callers 1

portfolio_reportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected