Data Types - Why Different Boxes?
Card 3 of 15

Why Can't We Treat All Information the Same?

"There are different types of information out there, and we have to treat each one differently."

The Three Fundamental Types

String (str)

Text/Words

"Hello World"

Strings are sequences of characters. Anything in quotes.

Integer (int)

Whole Numbers

42

Numbers without decimals. Can do math with them.

Boolean (bool)

True/False

True

Only two values: True or False. Like a light switch (on/off).

Why Types Matter

Operations that work on one type don't work on others:

Click operations to see results
Mental Model: Types are like tools. You can't hammer in a screw. You can't saw with a screwdriver. Same data, different tools, different results.

Type Conversion (Casting)

Sometimes you need to convert between types:

age = "25"        # This is a string
age = int(age)    # Now it's a number: 25

score = 100       # This is a number
score = str(score) # Now it's a string: "100"
"Understanding types is understanding what operations make sense. You don't 'add' words the way you add numbers. The computer needs to know which 'add' you mean."
[######........................] 03/15
> [WHY_IT_MATTERS]:
Data is potential energy. Operations convert it into kinetic action.
Cute Computer Mascot