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

Function print_report

Solutions/3_2/report.py:53–61  ·  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

51 return rows
52
53def print_report(reportdata):
54 '''
55 Print a nicely formated table from a list of (name, shares, price, change) tuples.
56 '''
57 headers = ('Name','Shares','Price','Change')
58 print('%10s %10s %10s %10s' % headers)
59 print(('-'*10 + ' ')*len(headers))
60 for row in reportdata:
61 print('%10s %10d %10.2f %10.2f' % row)
62
63def portfolio_report(portfoliofile,pricefile):
64 '''

Callers 1

portfolio_reportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected