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

Function print_report

Solutions/4_4/report.py:39–47  ·  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

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

Callers 1

portfolio_reportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected