Variables DataTypes Operators: Concept Notes
"""
Topic 02: Variables, Data Types & Operators - Concept Notes
1. Variables
- Names used to store data.
- Must start with a letter or underscore. Case-sensitive.
- Use snake_case (e.g., user_age) by convention.
2. Data Types
- int: Integers (1, -5, 100)
- float: Decimal numbers (3.14, -0.01)
- str: Text ("Hello", &
- bool: True or False
3. Arithmetic Operators
+ (Add), - (Sub), * (Mul), / (Div)
// (Floor Div), % (Modulus), ** (Exponent)
4. Comparison & Logical Operators
- ==, !=, >, <, >=, <=
- and, or, not
"""
__PH_1__
x = 10
y = 3.5
name = "Alice"
is_student = True
__PH_2__
print(f"Type of x: {type(x)}")
print(f"Type of y: {type(y)}")
__PH_3__
print(f"Addition: {10 + 5}")
print(f"Exponent(2^3): {2 ** 3}")
print(f"Floor Division(10 // 3): {10 // 3}")
print(f"Modulus(10 % 3): {10 % 3}")
__PH_4__
greeting = "Hello"
target = "World"
print(greeting + " " + target) __PH_5__
print(greeting * 3) __PH_6__
__PH_7__
age_str = "25"
age_int = int(age_str)
print(f"Age in 5 years: {age_int + 5}")