Lesson 2: Variables & Data
Variables are like "boxes" where you can store information to use later. In Python, you don't need to tell the computer what type of box you need (like in other languages), it figures it out by itself!
How to create a variable?
Use the = symbol to put a value into a name.
name = "Vincenzo"
age = 30
Common Data Types
- Strings (str): Text, enclosed in quotes (" or '). Ex:
"Hello" - Integers (int): Whole numbers. Ex:
42 - Floats (float): Decimal numbers. Ex:
3.14
Your Objective
Let's try to create a variable for your name and one for your birth year, then print them.
- Create a variable
namewith your name. - Create a variable
yearwith the current year (e.g., 2026). - Use
print(name, year)to see them together.