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

Function print_report

Solutions/3_14/report.py:31–39  ·  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

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

Callers 1

portfolio_reportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected