Skip to main content
Crowdfunding
Python + AI for Geeks
Practice

How to Write Prompts That Get the Right Answer the First Time

Crafting inefficient prompts can prevent you from getting the desired answer from AI, wasting your valuable time.

To write a good prompt for a satisfactory answer in one go, consider the following four key factors.


1. Clearly Specify Numbers, Locations, and Times in the Prompt

Similar to how you would direct a person, you have to be as specific as possible when assigning tasks to AI.

If you want to achieve the desired outcome clearly, it's advisable to specify the time, location, and number of results in the prompt.

Bad Prompt Example
Recommend a good book.
Good Prompt Example
Recommend three self-help books that were published in 2023 and have high sales figures in the U.S.

In the prompt above, the time is specified as 2023, the location as the U.S., and the number of results as three books.


2. Add Example Answers

Provide the desired answer format with examples to clearly convey the expected response.

Bad Prompt Example
Create a project plan for website development.
Good Prompt Example
Create a project plan for a company introduction website following the format below:

1. Project Overview: Explain the purpose and scope of the project
2. Key Phases: Outline the main tasks and expected duration for each development phase
3. Personnel and Budget: Summarize required personnel and budget

Example:
1. Project Overview: Redesign the existing e-commerce website and optimize servers for a smooth user experience
2. Key Phases:
- Requirements Gathering: Interviews with clients and stakeholders (1 week)
- Design: Create UI/UX design and prototype (2 weeks)
- Development: Frontend and backend development (4 weeks)
3. Personnel and Budget:
- Personnel: 1 Frontend Developer, 1 Backend Developer, 1 Designer
- Budget: Total $50,000

3. Utilize Dividers

Use dividers to enhance readability by separating important information or text blocks.

Bad Prompt Example
Translate into English
Once successfully implemented, this technology can be widely used across various industries.
We hope it will bring positive changes to society overall.
Good Prompt Example
### Instructions
You are a professional translator.
Translate the text below into English and highlight three key English terms.

### Text to Translate
"""
Once successfully implemented, this technology can be widely used across various industries.
We hope it will bring positive changes to society overall.
"""

### Translation Result
[Enter Translation Result Here]

### Key English Terms
[Enter Key Terms Description Here]

In the example above, ### is used to distinguish sections, and the areas for the translation result and key term descriptions are marked with [ ].

Triple quotes """ can be used like block quotes or to emphasize specific words like "three terms."


4. Set Limit on Length or Goals

Guide towards a clear answer by limiting the length of the response or setting specific goals.

Bad Prompt Example
Explain the seriousness of population decline due to low birth rates.
Good Prompt Example
Explain the seriousness of population decline due to low birth rates in less than 200 characters.

Using these four points, you can get the desired answer more easily.

In the following chapters, we will delve into the details of each item.


Practice

Send a prompt example and compare the AI's responses.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.