1. Learn
  2. /
  3. Courses
  4. /
  5. ChatGPT Prompt Engineering for Developers

Exercise

Analyze solution correctness

You're back from your relaxing vacation and you've been assigned the task of reviewing and correcting some programming tasks that your interns were working on during your absence. One of the tasks they were assigned is the calculation of the area of a shape. You are provided with a code string that contains a function designed to calculate the area of a rectangle, and need to assess its correctness. The ideal function for you is a function that has correct syntax, receives two inputs, and returns one output.

The openai package and the get_response() function have been pre-loaded for you.

Instructions

100 XP
  • Assign your API key to openai.api_key.
  • Create a multi-step prompt asking the model to assess the function provided in the delimited code string according to your ideal function criteria.