In this lab, you will work with a greedy change command-line tool and a traveling salesman algorithm. You will modify the command-line tool, reflect on its robustness, and explore ways to enhance the scripts.
By the end of this lab, you will:
- Understand how to modify command-line tools for improved robustness.
- Learn how to enhance scripts for better performance and functionality.
-
Run the greedy change command-line tool:
python greedy_coin.py 1.50
-
Change the code to have a flag for dollars and flag for cents, i.e.,
--dollars
and--cents
.
Reflection question: Is this version of the command-line tool more robust against errors?
Reflection question: What could you build to enhance this script? Do it and add it to your portfolio.
-
Run the traveling salesman algorithm:
python tsp.py simulate
-
What is the optimal number of simulations to run?