Files
coding-mentor-agent/kb/python-course-kb-practical-python/wiki/exercises/3-16-making-scripts.md
T

1.3 KiB

id, source_exercise_id, title, section, source_path, source_repo, source_commit, student_visible_solution, has_private_solution, skip
id source_exercise_id title section source_path source_repo source_commit student_visible_solution has_private_solution skip
practical-python-3.16 3.16 Making Scripts 3.5 Main Module 03_Program_organization/05_Main_module.md https://github.com/dabeaz-course/practical-python 93dca856b41c61a0a0f85ae334116e4c125629ea false true false

Exercise 3.16: Making Scripts

Source: Practical Python Programming, 03_Program_organization/05_Main_module.md.

Exercise 3.16: Making Scripts

Modify the report.py and pcost.py programs so that they can execute as a script on the command line:

bash $ python3 report.py Data/portfolio.csv Data/prices.csv
      Name     Shares      Price     Change
---------- ---------- ---------- ----------
        AA        100       9.22     -22.98
       IBM         50     106.28      15.18
       CAT        150      35.46     -47.98
      MSFT        200      20.89     -30.34
        GE         95      13.48     -26.89
      MSFT         50      20.89     -44.21
       IBM        100     106.28      35.84

bash $ python3 pcost.py Data/portfolio.csv
Total cost: 44671.15

Contents | Previous (3.4 Modules) | Next (3.6 Design Discussion)

关联来源