What are Python Data Types?
In Python, data types tell us what kind of value a variable holds, like a number,
word, list of items, etc.
Python treats everything as an object, and data types are used to classify those objects.
1. Numeric Data Types
These are used for storing numbers.
2. Sequence Data Types
These store a collection of values in order.
3. Boolean Data Type
Only two values: True or False
Used in comparisons and decision-making.
4. Set Data Type 5. Dictionary Data Type (dict)
Stores unique values, and the order is not fixed. Stores key: value pairs. Like a mini-database.
Data Type Description Example
int Whole numbers 5
Decimal
float 3.14
numbers
Quick Summary Chart: Imaginary
complex 2+3j
numbers
str Text "Hello"
bool True or False True
Unordered,
set {"a", "b"}
unique
dict Key-value pairs {"name": "Ali"}
What Are Conditional Statements?
Conditional statements let your program decide what to do based on conditions.
For example, "If it’s raining, take an umbrella."
In Python, we use:
•if
•if-else
•if-elif-else
•nested
•match-case
•ternary operator
Quick Comparison Table:
Type Use Case Example Result
if Check one condition "Yes" if true
if-else One block if true, else another "Yes" or "No"
if-elif-else Multiple condition checks "Child", "Teen" etc
nested if If inside another if Complex logic
short-hand if Compact one-line check Simple print
ternary One-line if-else "Pass"/"Fail"
match-case Match value with cases "One", "Two", etc.