Practicing control flow & file handling with Python 3
Sal has a shipping company and wants to help her customers find the lowest-cost method of shipping their packages. So, it's my job to write the program to help her customers decide between 3 shipping methods:
- drone shipping
- ground shipping,
- premium ground shipping
Package Weight (lbs) | Price / Pound ($ / lb) | Flat Fee ($) |
---|---|---|
less than or equal to 2 | 4.50 | 0.00 |
more than 2, less than or equal to 6 | 9.00 | 0.00 |
more than 6, less than or equal to 10 | 12.00 | 0.00 |
more than 10 | 14.25 | 0.00 |
Package Weight (lbs) | Price / Pound ($ / lb) | Flat Fee ($) |
---|---|---|
less than or equal to 2 | 1.50 | 20.00 |
more than 2, less than or equal to 6 | 3.00 | 20.00 |
more than 6, less than or equal to 10 | 4.00 | 20.00 |
more than 10 | 4.75 | 20.00 |
- Python 3
- VSCode
The inspiration for this project was Codecademy's Python 3: Control Flow project called Sal's Shipping.
They provided example code of how to complete the job.
A lot is different from Codecademy's practice project.
- About the README:
- The Shipping Cost content was added to this README file programmatically
- because why would I type tables out in 5 minutes when I could spend much, much more time figuring out how to write a file-handling program to add the tables for me?
- Need to look into the error handling for the file-handling program
- The Shipping Cost content was added to this README file programmatically
- About the program to help Sal & her customers:
- It is currently set to print the results to the terminal
- it'll likely remain that way for a long time since I'd rather spend more time with Big O at the moment
- Challenged myself to try syntax that's newer to me
- there are likely parts of the program that you'd wish were more readable
- in a few months from now, I'll probably wish the same
- It is simplified to a function that will take the package weight as an argument
- could've written the return/print message a bit differently to better present the info to the customer
- There are example function calls in the use_the_fxn file
- the purpose of this file is to practice importing functions in Python
- Need to verify the function's argument type
- verify/sanitize user input
- It is currently set to print the results to the terminal
- Critique:
- I'm open to criticism; very much want to improve rapidly
- If you notice something weird, or unsafe, or have food for thought, please don't hesitate to let me know