# Python Course Book: Step-by-Step Complete Guide
**Edition:** 2025
**Author:** Aafan's Python Learning Series
---
## Preface
Welcome to the complete Python course book. This book is written for absolute beginners and
professionals alike. You will learn Python programming from scratch — starting from basic syntax to
advanced concepts like OOP, data science, and web development.
---
# CHAPTER 1 — Introduction to Python
Python is an interpreted, high-level, dynamically typed, and open-source programming language.
**Why Python?**
- Easy to learn and readable syntax
- Cross-platform
- Huge library support
- Great for automation, AI, data science, and web
**Applications:**
1. Web development (Flask, Django)
2. Data science (pandas, numpy)
3. AI/ML (scikit-learn, tensorflow)
4. Automation and scripting
---
# CHAPTER 2 — Installation & Setup
Download from [[Link]]([Link]
Use **VS Code** or **PyCharm** as IDE.
**Windows:**
```
python --version
pip install --upgrade pip
```
**Mac/Linux:**
```
sudo apt install python3
```
---
# CHAPTER 3 — Python Basics
**Hello World**
```python
print("Hello, World!")
```
**Comments:**
```python
# This is a comment
```
---
# CHAPTER 4 — Variables and Data Types
Python supports int, float, str, bool, and complex numbers.
```python
x = 10
y = 3.14
name = "Aafan"
is_active = True
```
---
# CHAPTER 5 — Operators
Arithmetic, Logical, Comparison, Bitwise, Assignment, Membership, Identity.
```python
a, b = 5, 2
print(a + b, a ** b, a // b)
```
---
# CHAPTER 6 — Conditional Statements
```python
if x > 0:
print("Positive")
elif x == 0:
print("Zero")
else:
print("Negative")
```
---
# CHAPTER 7 — Loops
```python
for i in range(5):
print(i)
while i < 10:
i += 1
```
---
# CHAPTER 8 — Functions
```python
def add(a, b):
return a + b
print(add(2, 3))
```
---
# CHAPTER 9 — Lists & Tuples
```python
numbers = [1, 2, 3, 4]
[Link](5)
coords = (10, 20)
```
---
# CHAPTER 10 — Strings
```python
name = "Python"
print([Link](), [Link](), name[0])
```
---
# CHAPTER 11 — File Handling
```python
with open("[Link]", "w") as f:
[Link]("Hello!")
with open("[Link]") as f:
print([Link]())
```
---
# CHAPTER 12 — Exception Handling
```python
try:
x=1/0
except ZeroDivisionError:
print("Cannot divide by zero!")
finally:
print("End")
```
---
# CHAPTER 13 — OOP in Python
```python
class Person:
def __init__(self, name):
[Link] = name
def greet(self):
print(f"Hi, {[Link]}")
```
---
# CHAPTER 14 — Flask Web Development
```python
from flask import Flask
app = Flask(__name__)
@[Link]("/")
def home():
return "Welcome!"
[Link]()
```
---
# CHAPTER 15 — Projects
1. To-do App
2. Calculator
3. Weather API App
4. Portfolio Website
5. Data Visualizer
---
**End of Book** — Thank you for reading!