ChatGPT Code Explanations

March 24, 2023

Using ChatGPT 3.5 to explain code to beginners, port it to other languages, and construct assessments and grading rubrics.

The responses shown were the first responses. Nothing was cherry-picked.

Ask ChatGPT to explain an example from a tutorial. This is from a sequence that introduces the concept of a loop (ChatGPT doesn’t know this), so I asked a follow-up question about the loop. Future: Tell it more about the tutorial and where in the sequence this example comes from, so that it can target the explanation.
Ask ChatGPT to explain an example from a tutorial. This is from a sequence that introduces the concept of a loop (ChatGPT doesn’t know this), so I asked a follow-up question about the loop. Future: Tell it more about the tutorial and where in the sequence this example comes from, so that it can target the explanation.
A second follow-up question. Note: It uses ASCII art to illustrate the screen, but gets the horizontal and vertical axes backwards.
A second follow-up question. Note: It uses ASCII art to illustrate the screen, but gets the horizontal and vertical axes backwards.
[…and it continues.] ChatGPT can also be used to explore alternative programming techniques, patterns, constructs, and paradigms. In other experiments, I‘ve used it to translate strictly procedural code into OO and functional code.
[…and it continues.] ChatGPT can also be used to explore alternative programming techniques, patterns, constructs, and paradigms. In other experiments, I‘ve used it to translate strictly procedural code into OO and functional code.
[…and so on.]
[…and so on.]

Things to note:

  • The markdown illustrations in its answer to “walk through a couple of iterations” show the circles advancing in y, instead of x
  • This conversation is with ChatGPT 3.5 — not the newer, and reportedly better-in-almost-all-respects, ChatGPT 4.
  • It is sometimes wrong. I asked it about https://openprocessing.org/sketch/1394804, and it said the code drew a Fibonacci spiral. I changed the name of the function from fibRect to recurse and tried again in a fresh chat, and it said it drew a Pythagoras Tree. Neither of these is correct. (Its line-by-line explanations were accurate, though.)

Debugging

image

Translating

Translating p5.js to Processing, and to Arduino. (Not tested. I don’t have an LED matrix. It looks plausible and compiles.)

image
image
…and so on.
…and so on.

Generating assessments and grading rubrics

image
image
image
…and so on, for the remaining questions.
…and so on, for the remaining questions.