Please enable JavaScript to use CodeHS

  • AI

Prompt Engineering for Coding

In this project, students learn about what makes a good prompt in the context of programming. Students will be given an image with the goal of getting ChatGPT (or another generative AI model) to write the code in p5.js. While an understanding of p5.js will benefit students, this project can be completed without any knowledge of the language.

Medium

2 Hours

High School

Middle School

Project Description

The goal of prompt engineering is to guide a generative AI model, such as ChatGPT or Gemini, to produce a desired output. Prompt engineering is founded on the following principle: an AI’s output is only as good as the question it is asked. The way a prompt is phrased and what information it includes can significantly influence the generated response. With this in mind, prompt engineering is all about creating the right set of questions or instructions.

In this project, students will explore how to write effective prompts as they try and get ChatGPT to write three simple programs in the coding language p5.js.

Project Demo

Explore this program before assigning it!