Why this matters
You can ask a tool to write a story, summarise a long article, help you study, or even write a program, all in plain language. That tool is generative AI, and the rest of this chapter uses it as a helper to build web pages and games. To use it well, you first need to know what it is actually doing, and where it can let you down.
The idea
A generative AI has learned from huge amounts of text from around the world. When you give it a prompt (your instruction), it answers by repeatedly choosing the word most likely to come next. Ask "What is the capital of Egypt?" and it builds the sentence "The capital of Egypt is Cairo," not because it knows this as a fact, but because "Cairo" is the most likely word to follow that phrase.
That is its great strength and its weakness at once. It is excellent at producing natural text, ideas, summaries, study help, and code. But because it works by probability, it will sometimes state something wrong while sounding completely sure. This mistake is called a hallucination.
The rule that follows: generative AI is a powerful assistant, but never trust it 100%. Always check important answers against a reliable source.
Picture it
flowchart LR
A[You write a prompt] --> B[AI predicts the most likely next words]
B --> C[Generated answer]
C --> D{Is it important?}
D -- Yes --> E[Verify with a trusted source]
D -- No --> F[Use as a draft / idea]
Worked example
You prompt: "Give me a quiz about Egypt. Wait until I answer." The AI generates questions and pauses for your reply. You can then refine it in plain language: "Make them True or False", "Show my score at the end", "Make it 5 questions". Each new prompt reshapes the output.
Now you ask "Who built the pyramids of Egypt?" The answer sounds confident, but it could be a hallucination. So you check a search engine or ask your teacher before trusting it. Same idea with code later in this chapter: the AI may write a program that works, or one with a hidden bug, so you read and test what it gives you.
Your turn
Open a generative AI tool and try the prompts above yourself: write a short story, then refine it with a follow-up prompt, then create a quiz. Notice how a clearer prompt gives a better answer. Then practise the questions below to check your understanding.
Recap
- Generative AI answers a prompt by predicting the most likely next words.
- It is great for ideas, summaries, study help, and code, but it does not truly "know" facts.
- It can hallucinate (sound confident while being wrong), so verify important answers.