A New Chat
Building a program in small steps makes for a long chat: the plan, a piece, a run, the next piece, a change. Every message stays in the chat, and so does every version of the program in it: the one you attached at the start and each piece the assistant wrote since. What the chat doesn't have is what you changed in the editor yourself without attaching the program again.
Say you built Mia's report in one chat, as in the exercises before. After the discount, Mia tried out a price of £7 a started half hour for a week, and you changed walk_price() yourself, without attaching the program again. Then, in the same chat, you asked for the longest walk, said that the rest should stay as it was, and asked for the whole program. One answer began:
Here is the whole program with longest_walk added and a "Longest:" line at the end of print_report:
def walk_price(minutes):
half_hours = minutes // 30
if minutes % 30 > 0:
half_hours = half_hours + 1
return half_hours * 6That's the old price. The assistant left the rest as it was, as you asked, but as it was in the chat, not in your editor. Pasted in, the program would charge £6 again. The other answers in that chat brought the old price back too.
In a short chat, attaching the program again after you change it is enough, as in Finding Mistakes with AI. When a chat has grown long, with many versions of the program in it, start a new one with New chat. Attach the program as it is now and say in a sentence what it does: the assistant then works from your program and nothing else. The chat in this exercise is new, and the program in the editor is the report with the week's price of £7.
Instructions
- 1
Attach
script.pyand say in a sentence what the program does. Ask for the next piece: a functionlongest_walk(walks)that returns the longest walk, and a line at the end ofprint_report()that prints it afterLongest:. Say that the rest stays as it is, and ask for the whole program, so that you can paste it in one go. Then send it. - 2
Copy the program from the answer and paste it into the editor in place of yours. Run it: the report has a new last line,
Longest: 60, and the total isTotal: 51: at £7 a started half hour, the walks cost 56, less the £5 off.