liveBook · Manning

Prompt

As explained in A Pythonic Adventure: From Python basics to a working web app

A prompt is an instruction or question supplied to an AI system to elicit a response.

A prompt is a precise instruction or question supplied to an AI system. Instead of casually asking how it is doing, describe the help you need, give the relevant code or error, and explain the expected result. section 14.0

A useful prompt can ask AI to:

  • Act as a code reviewer and comment on structure, syntax, potential errors, and improvements. section 14.0
  • Explain a Python feature, such as list comprehension, with examples. section 14.0
  • Explain an error message and help correct the code that caused it. section 14.0
  • Add comments to a function or suggest other ways to use AI. section 14.0

A code-review prompt

“Act as a code reviewer. Give me feedback on the code structure, syntax, potential errors, and improvements. Here is my first function to review:” Then include the function below the request. section 14.0

Act as a code reviewer. Your task  is to receive a function from me and
give me feedback on the code structure, syntax, any potential errors, and
improvements that can be made.
Here is my first function to review:

Browse the complete reusable instruction for requesting a function review. section 14.0

How A Pythonic Adventure: From Python basics to a working web app covers it

How deep it goes
Explains prompt precision through role, task, code, and follow-up examples, without covering prompt internals.
Examples
Uses a read_menu function, list-comprehension questions, a TypeError traceback, and analogy questions as prompt examples.
What it assumes
Assumes a Python function or error to share while demonstrating request structure from practical examples.
What you can do after
Apply it via ChatGPT to request targeted programming help and continue with clarifying questions.
How it connects
Connects prompts with code review, error messages, list comprehension, comments, and Python functions.

Also explained in

Compare how 50 books explain prompt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of A Pythonic Adventure: From Python basics to a working web app. The section links point to the parts of the book it draws on.