CHAPTER 2

Data is Food 🍎⚡

To teach a computer, we must translate the world into Numbers.

Computers can't see "Red" or "Bumpy". But they can see 1 and 0!

📊 Features

A "Feature" is a fact about an object translated into a number.

Feature 1: Weight

Light = 0
Heavy = 1

Feature 2: Surface

Smooth = 0
Bumpy = 1

Example using Lists:

# [Weight, Surface]
apple = [1, 0] # Heavy & Smooth
orange = [1, 1] # Heavy & Bumpy

FEED THE ROBOT 🥣

Step 1: Define an Apple

Let's say Red is 1 and Yellow is 0.

Create an apple list with [1] (Red).

apple = [1]
print(apple)
Waiting for you to run code...

Step 2: Add a Banana

Now create a banana. It is Yellow (0).

apple = [1]
banana = [0]
print(banana)
Locked 🔒

Step 3: More Features

Let's add Shape!
Round = 1, Long = 0.

Update your lists to have 2 numbers: [Color, Shape].

# Apple: Red(1), Round(1)
apple = [1, 1]
# Banana: Yellow(0), Long(0)
banana = [0, 0]
print("Data Ready!")
Locked 🔒
📏

Data Check 📝

1. Why do we change words into numbers?

⌨️ DATA LAB
Waiting...