The Mistake in the Discount
The third dog walks for free: 30 minutes with three dogs cost 9, the same as with two. The lines for one dog and for two are right, so the mistake is in what dogs_price() does with more than two.
Find it with the assistant, as in Finding Mistakes with AI. It needs the program and what it printed: the Attach to message button on the console attaches that as output.txt. It needs what you expected, because nothing in the program says what a third dog costs: that's Mia's rule, and only you know it. Without it, the answers we got guessed the rule and said they were guessing. And ask for the smallest change, the line to change and why, not for a new function.
Asked only to fix the program, every answer we got gave the whole function again, some with walk_price() too, and some rewrote it with a variable it hadn't had, extra_dogs. They worked, but you'd have had to compare them with yours line by line to see what had been wrong. With the smallest change, you see the mistake, and nothing else in Mia's program moves.
Instructions
- 1
Run the program, attach
script.pyand what it printed, and say what the last line shows and what you expected by Mia's rule. Ask which line to change and why, with the smallest change that fixes it. Then send it. - 2
Make the change in the editor and run the program. The last line is now
30 min, 3 dogs: 12, and the lines before it print what they did before. Keep the line for three dogs as it is: the exercise also runs the program with four dogs and with a longer walk.