Let It Quiz You
You've read a program, or had it explained, and it made sense. Whether you really understand it shows when you work something out with it yourself: what does the function return for other walks? An AI can ask you questions like that, as many as you want.
The function first_long_walk() in the editor returns the number of the first walk that's longer than a limit: for the walks in the program and a limit of 50 minutes, it returns 3. It has a return inside the loop, on purpose this time, and a return 0 after the loop.
A quiz works best as a conversation: one question, your answer, then the next question. Asked only Quiz me on this program., the assistant listed five questions or more at once, in every answer we got. So ask for one question at a time, and for the answer only after you've tried. Ask about other walks and limits than the program's own: what it prints for its own, you've already seen.
You can check your answer without anyone's help: add a line that prints the function's result for the question's walks and limit, and run the program. When you've checked, tell the AI what you worked out and ask for the next question, for as long as you like.
Instructions
- 1
Attach
script.pyand ask the AI to quiz you on it: one question at a time, each asking whatfirst_long_walk()returns for other walks and another limit than the program's own, and no answer before you've tried. Then send it. - 2
Work out the answer yourself. Then check it: at the end of the program, add a line that prints what
first_long_walk()returns for the walks and the limit in the question, and run the program.