Please enable JavaScript to use CodeHS

AI Tutorial

What is AI?

Artificial intelligence is all around you. Learn what makes a computer program “smart,” spot real AI in everyday life, and play a quick game to test your intuition.

AI ~10 min Beginner friendly
The Big Idea

What is AI?

Artificial intelligence — or AI — is when a computer does a job that usually needs human thinking. That could mean recognizing a face in a photo, understanding spoken words, or suggesting the next song you might like.

But here is the key part: an AI system learns from examples. It is not just following a long list of instructions that a human wrote out one by one. Instead, it looks at tons of data, finds patterns, and uses those patterns to make guesses about new things it has never seen before.

Simple definition: AI is a computer program that learns patterns from examples so it can make decisions or predictions about new data.

Regular computer programs are like recipes. A recipe tells you exactly what to do, step by step. AI is more like a chef who has tasted hundreds of dishes and can improvise a new sauce based on what worked before.


Interactive

AI or regular code?

Not every “smart” thing a computer does is AI. A calculator follows hard-coded rules. A spam filter learns from examples. Can you tell the difference?

Click AI if the example learns from data. Click Not AI if it follows a fixed set of rules.

AI sorter Score: 0 / 0

Calculator app

You type 12 × 7 and it always answers 84.

Email spam filter

It decides which messages belong in the spam folder.

Room thermostat

It turns the heat on when the room drops below 70°.

Video recommendations

After you watch a few cat videos, it suggests more cat videos.

Video game enemy patrol

A guard walks left, right, left, right on a set route.

Voice assistant

You say, “What is the weather?” and it answers out loud.


How It Works

The learning loop

Most AI systems learn in three big steps. You can think of them as look, find, and guess.

Look → Find → Guess
1. Look at lots of examples
2. Find patterns
3. Make guesses about new things

For example, imagine you want to teach a computer to recognize pictures of dogs. You show it thousands of dog photos and thousands of not-dog photos. The AI finds patterns like “furry,” “four legs,” and “floppy ears.” Then, when you show it a brand new photo, it guesses whether a dog is in it.

Watch out: AI does not “understand” dogs the way you do. It is matching patterns. That is why AI can make weird mistakes, like thinking a fluffy towel is a dog because it looks furry.


Real World

AI in the real world

Here are a few places you probably run into AI without even realizing it.

  • Autocorrect: It learns from the words you type and suggests the next word.
  • Maps apps: They predict traffic and pick the fastest route.
  • Video games: Some enemies learn from how you play and try new strategies.
  • Music playlists: They learn your taste and recommend songs.
  • Cameras: They can spot faces and focus on them automatically.

All of these tools have one thing in common: they get better by learning from data, not by following a fixed script.


Code

A rule-based spam detector

This Python program decides if an email is spam using hard-coded rules. It is not AI because it cannot learn from new examples, but it shows why learning is useful: the rules are fragile and easy to break.

Notice how the word "free" makes every message with it look like spam, even if a friend wrote "free concert tickets." Real AI learns which words matter from thousands of labeled examples, so it can handle new situations better.


Your Turn

Check your understanding

Name one thing AI is good at that would be hard to write as a fixed set of rules. Then name one thing humans still do better than AI.

Your answer:

Sample answer: AI is good at sorting through millions of photos to find ones with cats. Humans are still better at common sense, like knowing that a cat on a skateboard is funny.


Check Yourself

Quick quiz

1. Which sentence best describes AI?

2. Which of these is most likely powered by AI?

3. What is the biggest difference between AI and regular code?

Keep learning about AI

Now that you know what AI is, find out how computers actually learn from examples. The next tutorial introduces machine learning with a simple pattern-matching game.

Part of the “Are LLMs smarter than a 5th grader?” tutorial series.