Table of Contents
1. [Python Fundamentals] (#python-fundamentals)
2. [Data Structures] (#data-structures)
3. [Control Flow] (#control-flow)
4. [Functions and Modules] (#functions-and-modules)
5. [Object-Oriented Programming] (#object-oriented-programming)
6. [Data Science Libraries] (#data-science-libraries)
7. [Data Analysis with Pandas] (#data-analysis-with-pandas)
8. [Data Visualization] (#data-visualization)
9. [Statistics and Probability] (#statistics-and-probability)
10. [Machine Learning Basics] (#machine-learning-basics)
11. [Quick Review Checklist] (#quick-review-checklist)
12. [Common Exam Mistakes] (#common-exam-mistakes)
,Python Fundamentals
Variables and Data Types
**Key Concepts:**
Python uses dynamic typing, meaning you don't need to declare variable types explicitly. The interpreter determines the type at runtime.
> **Important Data Types:**
> - `int`: Whole numbers (e.g., 42, -17)
> - `float`: Decimal numbers (e.g., 3.14, -0.5)
> - `str`: Text strings (e.g., "Hello", 'Python')
> - `bool`: True/False values
> - `None`: Represents absence of value
**Real-world Example:**
```python
# E-commerce inventory system
product_name = "Laptop" # str price
= 899.99 # float quantity = 25 # int
in_stock = True # bool
discount = None # None (no discount currently)
```
**Memory Trick:** **"FIBS N"** - Float, Int, Bool, String, None
### String Operations
, **Key Concepts:**
Strings are immutable sequences of characters. You can manipulate them using various methods and operators.
> **Essential String Methods:**
> - `.upper()`, `.lower()`: Change case
> - `.strip()`: Remove whitespace
> - `.split()`: Split into list
> - `.join()`: Join list into string
> - `.replace()`: Replace substrings
**Real-world Example:**
```python
# Processing user input for a login system email = "
"
clean_email = email.strip().lower() # "" username =
clean_email.split('@')[0] # "user"
```
**Practice Question:**
*Q: Write code to extract the domain from an email address ""*
**Answer:** ```python
email = "" domain =
email.split('@')[1] # "company.com" # Alternative:
domain = email[email.index('@')+1:]
```