It Sees Only What You Send
Welcome to Programming with AI. You can already write programs in Python. In this course, you'll write them with an AI assistant beside you, as most programmers now do: you'll have code explained, say what code you need, find mistakes, and learn from the answers instead of only copying them. Above all, you'll check what the assistant gives you, because its code can be wrong and still sound sure.
Most exercises have a program in the code editor, with the Run button and the console, and a chat with a real AI. A second AI reads each answer and checks it against the instruction, so you see at once whether your message worked. The instructions about the program are checked when you run it, as in the Python course.
The first thing to know about an assistant is that it sees only what you send it: not the code editor, not the console, not this lesson. It's the same in a chat app, where the AI doesn't know what's open on your computer until you paste it or attach it. Ask about your program without it, and a good assistant asks you for it. A worse one answers anyway, about a program it has imagined.
In this course, you'll help Mia, who walks dogs after school. The program in the editor goes through this week's walks, each a number of minutes in a list, and finds the longest. The message in the chat box asks what it prints, but the AI has never seen the program. To send it, click Attach to message over the program: script.py then goes with your next message, as it is at that moment.
Instructions
- 1
Click Attach to message over the program, so that
script.pygoes with the message in the chat box. Then send the message. The answer should say what the program prints. - 2
Don't take the answer's word for it: click Run and compare the console with what the AI said. Then add a walk of
75minutes at the end of the list and run the program again. It printsWalks: 5andLongest: 75.