Understanding AI · lesson 6 of 60 · about 5 minutes
Everything Becomes Numbers
Computers only work with numbers. See how pictures, words and sounds are turned into numbers AI can learn from.
What you'll learn
- Explain that AI works with numbers
- Describe a picture as numbers for each dot
- Describe how words can become numbers
AI only sees numbers
A computer can't look at a photo or read a word the way you do. Everything has to become numbers first.
A photo is a grid of tiny dots called pixels. Each pixel is stored as numbers saying how bright it is. A black and white photo might use 0 for black and 255 for white.
Words and sounds too
Words can be numbered: give every word in a dictionary its own number. Sound is a wave, measured thousands of times a second, and each measurement is a number.
Once it's all numbers, AI can do maths on it and find patterns.
A tiny 3 by 3 black and white picture: a white cross on black. Each number is one pixel's brightness.
picture = [
[0, 255, 0],
[255, 255, 255],
[0, 255, 0],
]
print(picture[1])
print(picture[0][0])Output
[255, 255, 255]
0Tip
picture[1] is the second row (counting starts at 0). picture[0][0] is the top-left pixel.
Now try it yourself
This lesson is free in Codiqo, with 6 questions on what you just read. You can only learn to code by writing code, so it ends with a short program you write yourself, which we run and check straight away.