Feedback on Your Program
Before you finish the invoice, ask for feedback on your program, as in A Tutor, Not a Homework Machine: a few things to improve, each with why, and no new program. Asked only What could I improve in my program?, one answer listed ten things and then rewrote the whole program. In its version, print_weeks() was gone, count had become walk_count, half hours were rounded up with -(-minutes // HALF_HOUR_MINUTES), and it used if __name__ == "__main__":, which you haven't learned. That version may well work, but it isn't your program anymore: before you could change it, you'd have to learn it first.
Feedback is advice, and what you do with it is up to you. A suggestion you understand and agree with, you make yourself, in your program, with your names and with what you know. A suggestion you don't understand is something to ask about, not something to paste.
Answers also point out that the invoice doesn't show the discount yet. That's the next step, and it doesn't need the AI: the last two lines use count, total and discount(), which are all in the program already, and two short lines are quicker to write than to ask for.
Instructions
- 1
Attach
script.pyand ask for feedback: at most three things to improve, each with why, without a new version of the program. Then send it. - 2
Write the last two lines yourself. Under the line that prints the total, add a line that prints
Discount:anddiscount(count, total), and one that printsTo pay:and the total minus the discount. Run the program: the invoice ends withDiscount: 9andTo pay: 87. - 3
Answers usually say something about your tests: that their
Truelines end up in Mrs Carter's invoice, and thatassertorunittestwould be better. You don't need either to keep the tests out of the invoice: put them into a function. Above the four tests, writedef tests():and indent the tests under it. Run the program: it prints the invoice, and noTrue. A function runs only when it's called, so the tests now wait until you calltests().