Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

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. 1

    Attach script.py and ask for feedback: at most three things to improve, each with why, without a new version of the program. Then send it.

  2. 2

    Write the last two lines yourself. Under the line that prints the total, add a line that prints Discount: and discount(count, total), and one that prints To pay: and the total minus the discount. Run the program: the invoice ends with Discount: 9 and To pay: 87.

  3. 3

    Answers usually say something about your tests: that their True lines end up in Mrs Carter's invoice, and that assert or unittest would be better. You don't need either to keep the tests out of the invoice: put them into a function. Above the four tests, write def tests(): and indent the tests under it. Run the program: it prints the invoice, and no True. A function runs only when it's called, so the tests now wait until you call tests().

Back

5/6

  1. 1. The Invoice
  2. 2. Tests First
  3. 3. One Step at a Time
  4. 4. What the Test Shows
  5. 5. Feedback on Your Program
  6. 6. Congratulations!
Next

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with: