Debugging Activity
IPO Problems
How much is that doggie in the window? (including sales tax)
Pat Shopboys runs a popular animal supply store. She needs to write a program that will calculate the total cost of the sale.
Write a Python script that conforms to the following
- Inputs
- The cost of the item(s) purchased
- The local sales tax rate
- Print Statements
- Prints the the total bill.
- Example(s) of what it SHOULD look like:
- Special Instructions
- You should round the total price to two decimal places
- Note that this code will not add decimals if fewer than two are used in the answer
Consider the following solution. It consists of code with proper syntax. That means that when you save it in your IDE (like Thonny) it will save properly and not produce any errors at that point. But when you run it it might crash in certain situations (error #1) and it always produces wrong results (error #2).
Sometimes students will tell me "It works. But it doesn't give the right answers." [For reference, then it doesn't "work"!]
Identify the two errors in this program: