Daily Python
Day 2Python~30 min
Variables & Types
Strings, numbers, booleans, and type conversion
Track progress0/15 days
What you'll learn
strintfloatbooltype()int()f-strings
- Store data in variables with meaningful names
- Identify common Python data types
- Convert between string and integer
- Build a personalized greeting with age and color
Lesson & examples
Read the code, then the explanation — try changing values before the project.
Basic types
name = "Vivian" # str
age = 42 # int
height = 5.8 # float
is_student = False # bool
print(type(name))
print(type(age))Type conversion
age = "42"
myAge = int(age)
print(myAge + 5) # 47input() always returns a string. Use int() before doing math with numbers.
Three ways to format text
name = "Vivian"
print("Hello, " + name + "!")
print("Hello, {}!".format(name))
print(f"Hello, {name}!")