CHAPTER 4

The Lemonade Stand 🍋

Robo is running a Lemonade Stand. He wants to guess how many cups he will sell.
He knows that Hotter Weather = More Sales.

In AI, this "Guessing Game" is called Prediction.

⚖️ The Magic Weight

How do we turn Temperature into Sales? We multiply by a number called a Weight.

temp = 30
weight = 2
sales = temp * weight

Here, Robo thinks: "For every 1 degree of heat, I sell 2 cups."
So, 30 degrees = 60 cups!

BUILD THE PREDICTOR 🤖

Step 1: Set Variables

It's a hot day! Set temp = 40 degrees.
Set a weight = 2.

temp = 40
weight = 2
Waiting for you to run code...

Step 2: Make the Prediction

Calculate prediction by multiplying temp and weight.

prediction = temp * weight
print(prediction)
Locked 🔒

Step 3: Calculating Error

Robo actually sold 100 cups! How wrong was he?
Calculate actual = 100 and error = actual - prediction.

actual = 100
error = actual - prediction
print("Error:", error)
Locked 🔒
🌡️

Logic Check 📝

1. If the Error is 0, what does that mean?

⌨️ PREDICTION LAB
Waiting...