Numbers and Booleans (int · bool)
int (Integer)
Definition: A data type for whole numbers without a decimal point
Features
- Can represent positive numbers, negative numbers and 0
- Supports arithmetic (
+,-,*,/)
python
age = 25
score = 100
negative = -10
print(type(age)) # output: <class 'int'>
print(score + 10) # output: 110
print(score // 3) # output: 33 (integer division)bool (Boolean/Logical Value)
Definition: A data type with only two values, True or False
Features
- Often used as the result of comparisons
Trueis also treated as 1 andFalseas 0
python
is_student = True
is_adult = False
print(type(is_student)) # output: <class 'bool'>
print(5 > 3) # output: True
print(10 == 5) # output: False
print(bool(0)) # output: False
print(bool(1)) # output: TrueSummary
| Concept | Summary |
|---|---|
| int | Integer data type → number calculations |
| bool | True/False data type → expressing conditions |
Reference: personal Notion study notes (onboarding course)
