Anatomy of Variable Assignment
Variables store data. Click each part of the assignment statement below to understand its role. This uses Abstraction (giving data a name) and Data Representation (storing info).
Identify all 4 parts!
Spot the Data Type!
Different kinds of data have different types. Click the correct type button (`int`, `float`, `str`) for each value shown below. This is fundamental to Data Representation.
Identify the type for all examples!
Variable Creation Simulator
Time to create your own variables! In the editor, create a variable named `item_price` and assign it a floating-point number (e.g., `19.95`). Then, run the simulation to see its *type*.
Check `type()` Usage
The `type()` function tells you a variable's data type. Click on the line(s) below that correctly use `type()` to *get* the type of a variable (often inside `print()`).
Variable Missions!
Combine your skills! Complete these missions involving variables and types. Use the editor and check your output.
Mission 1: Integer Age
Create a variable named `robot_age` and assign it an integer value (e.g., 5). Then, on the next line, use `print(type(robot_age))` to display its type.
Mission 2: Float & String
Create two variables: `sensor_reading` assigned a float value (e.g., `3.14`), and `status_message` assigned a string (e.g., `"Operational"`). (No output needed, just correct assignment).
Mission 3: Dynamic Typing
Demonstrate dynamic typing. First, create a variable `data_value` and assign it the integer `100`. Print its type. Then, on the next lines, assign the *string* `"Warning"` to the *same* variable `data_value` and print its type again.
Module 1 Practice Complete!
Excellent work! You've practiced assigning variables and understanding basic data types (`int`, `float`, `str`).
Ready for a deeper challenge? Try the Advanced Practice for Module 1!