docs: overhaul README with new sections, detailed topic descriptions, and improved formatting.

This commit is contained in:
blshaer 2025-12-30 09:12:02 +02:00
parent 10fc3566bb
commit 8cfb9fd744

277
README.md
View File

@ -1,98 +1,163 @@
# Python Review - Complete Tutorial <p align="center">
<img src="https://cdn.dribbble.com/userupload/46214001/file/4a12b42c7c18b8e8fde467a3e977d601.png?resize=752x255&vertical=center" alt="Python Review Banner" width="100%">
</p>
A comprehensive Python tutorial covering everything from basics to advanced topics. <h1 align="center">🐍 Python Review</h1>
Each file is self-contained with detailed explanations and executable examples.
## 📚 Topics Covered <p align="center">
<strong>A Comprehensive Python Tutorial from Basics to Advanced</strong>
</p>
<p align="center">
<img src="https://img.shields.io/badge/Python-3.10+-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python Version">
<img src="https://img.shields.io/badge/License-MIT-green?style=for-the-badge" alt="License">
<img src="https://img.shields.io/badge/Status-Complete-success?style=for-the-badge" alt="Status">
</p>
<p align="center">
<em>Each file is self-contained with detailed explanations and executable examples.</em>
</p>
---
## <20> Table of Contents
- [Overview](#-overview)
- [Topics Covered](#-topics-covered)
- [Getting Started](#-getting-started)
- [Prerequisites](#-prerequisites)
- [File Structure](#-file-structure)
- [Learning Path](#-learning-path)
---
## 🎯 Overview
This repository contains a complete Python tutorial designed for both beginners and experienced developers looking to refresh their knowledge. Each topic is organized in separate folders with practical, runnable examples.
**Key Features:**
- ✅ **Self-contained files** — Each file can be run independently
- ✅ **Comprehensive comments** — Detailed explanations for every concept
- ✅ **Practical examples** — Real-world use cases and patterns
- ✅ **Progressive difficulty** — From basics to advanced topics
---
## <20>📚 Topics Covered
### 01. Basics ### 01. Basics
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_print.py` | Print function, formatting, escape characters | | [`01_print.py`](./01_basics/01_print.py) | Print Function | Output, formatting, f-strings, escape characters |
| `02_comments.py` | Single-line, multi-line comments, docstrings | | [`02_comments.py`](./01_basics/02_comments.py) | Comments | Single-line, multi-line, docstrings, best practices |
| `03_variables.py` | Variable assignment, naming, multiple assignment | | [`03_variables.py`](./01_basics/03_variables.py) | Variables | Assignment, naming conventions, multiple assignment |
| `04_data_types.py` | Numbers, strings, booleans, type conversion | | [`04_data_types.py`](./01_basics/04_data_types.py) | Data Types | Numbers, strings, booleans, type conversion |
### 02. Control Flow ### 02. Control Flow
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_if_else.py` | Conditionals, comparison operators, logical operators | | [`01_if_else.py`](./02_control_flow/01_if_else.py) | If/Else | Conditionals, comparison operators, logical operators |
| `02_elif.py` | Multiple conditions, grading systems, ranges | | [`02_elif.py`](./02_control_flow/02_elif.py) | Elif | Multiple conditions, grading systems, ranges |
| `03_match_case.py` | Pattern matching (Python 3.10+), guards, unpacking | | [`03_match_case.py`](./02_control_flow/03_match_case.py) | Match/Case | Pattern matching (Python 3.10+), guards, unpacking |
### 03. Loops ### 03. Loops
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_for_loop.py` | For loops, range(), enumerate(), zip() | | [`01_for_loop.py`](./03_loops/01_for_loop.py) | For Loops | Iteration, range(), enumerate(), zip() |
| `02_while_loop.py` | While loops, counters, sentinels, infinite loops | | [`02_while_loop.py`](./03_loops/02_while_loop.py) | While Loops | Counters, sentinels, infinite loops |
| `03_break_continue.py` | Loop control, break, continue, pass, for-else | | [`03_break_continue.py`](./03_loops/03_break_continue.py) | Loop Control | break, continue, pass, for-else |
### 04. Data Structures ### 04. Data Structures
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_lists.py` | Lists, indexing, slicing, methods, comprehensions | | [`01_lists.py`](./04_data_structures/01_lists.py) | Lists | Indexing, slicing, methods, comprehensions |
| `02_tuples.py` | Tuples, immutability, unpacking, named tuples | | [`02_tuples.py`](./04_data_structures/02_tuples.py) | Tuples | Immutability, unpacking, named tuples |
| `03_sets.py` | Sets, operations, frozen sets, practical uses | | [`03_sets.py`](./04_data_structures/03_sets.py) | Sets | Operations, frozen sets, practical uses |
| `04_dictionaries.py` | Dictionaries, methods, nesting, comprehensions | | [`04_dictionaries.py`](./04_data_structures/04_dictionaries.py) | Dictionaries | Methods, nesting, comprehensions |
### 05. Functions ### 05. Functions
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_function_basics.py` | Defining functions, scope, docstrings, nested functions | | [`01_function_basics.py`](./05_functions/01_function_basics.py) | Function Basics | Defining functions, scope, docstrings |
| `02_arguments.py` | Positional, keyword, *args, **kwargs, type hints | | [`02_arguments.py`](./05_functions/02_arguments.py) | Arguments | Positional, keyword, *args, **kwargs, type hints |
| `03_return_values.py` | Returns, multiple returns, early returns, generators | | [`03_return_values.py`](./05_functions/03_return_values.py) | Return Values | Multiple returns, early returns, generators |
| `04_lambda_functions.py` | Lambda, map, filter, reduce, functional patterns | | [`04_lambda_functions.py`](./05_functions/04_lambda_functions.py) | Lambda | Anonymous functions, map, filter, reduce |
### 06. Modules & Packages ### 06. Modules & Packages
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_imports.py` | Import patterns, standard library, module organization | | [`01_imports.py`](./06_modules_packages/01_imports.py) | Imports | Import patterns, standard library, organization |
| `02_custom_modules.py` | Creating modules, packages, __init__.py, __name__ | | [`02_custom_modules.py`](./06_modules_packages/02_custom_modules.py) | Custom Modules | Creating modules, packages, `__init__.py` |
### 07. Error Handling ### 07. Error Handling
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_try_except.py` | try/except/else/finally, catching exceptions | | [`01_try_except.py`](./07_error_handling/01_try_except.py) | Try/Except | Exception handling, else, finally |
| `02_custom_exceptions.py` | Creating exceptions, hierarchy, best practices | | [`02_custom_exceptions.py`](./07_error_handling/02_custom_exceptions.py) | Custom Exceptions | Creating exceptions, hierarchy, best practices |
### 08. Object-Oriented Programming ### 08. Object-Oriented Programming
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_classes_objects.py` | Classes, objects, attributes, methods, self | | [`01_classes_objects.py`](./08_oop/01_classes_objects.py) | Classes & Objects | Attributes, methods, self |
| `02_init_methods.py` | Constructors, properties, classmethods | | [`02_init_methods.py`](./08_oop/02_init_methods.py) | Init & Methods | Constructors, properties, classmethods |
| `03_inheritance.py` | Single/multiple inheritance, super(), MRO, ABC | | [`03_inheritance.py`](./08_oop/03_inheritance.py) | Inheritance | Single/multiple inheritance, super(), MRO |
| `04_polymorphism.py` | Duck typing, operator overloading, protocols | | [`04_polymorphism.py`](./08_oop/04_polymorphism.py) | Polymorphism | Duck typing, operator overloading, protocols |
### 09. Advanced Python ### 09. Advanced Python
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_list_comprehensions.py` | List, dict, set comprehensions, generators | | [`01_list_comprehensions.py`](./09_advanced_python/01_list_comprehensions.py) | Comprehensions | List, dict, set comprehensions |
| `02_generators.py` | Yield, iterators, memory efficiency, pipelines | | [`02_generators.py`](./09_advanced_python/02_generators.py) | Generators | Yield, iterators, memory efficiency |
| `03_decorators.py` | Simple/parameterized decorators, functools | | [`03_decorators.py`](./09_advanced_python/03_decorators.py) | Decorators | Simple/parameterized decorators, functools |
| `04_context_managers.py` | with statement, __enter__/__exit__, contextlib | | [`04_context_managers.py`](./09_advanced_python/04_context_managers.py) | Context Managers | with statement, `__enter__`/`__exit__`, contextlib |
### 10. Best Practices ### 10. Best Practices
| File | Topic | | File | Topic | Description |
|------|-------| |:-----|:------|:------------|
| `01_pep8.py` | Python style guide, naming, formatting | | [`01_pep8.py`](./10_best_practices/01_pep8.py) | PEP 8 | Python style guide, naming, formatting |
| `02_type_hinting.py` | Type annotations, typing module, generics | | [`02_type_hinting.py`](./10_best_practices/02_type_hinting.py) | Type Hinting | Type annotations, typing module, generics |
| `03_virtual_envs.py` | venv, pip, requirements.txt, project setup | | [`03_virtual_envs.py`](./10_best_practices/03_virtual_envs.py) | Virtual Environments | venv, pip, requirements.txt |
## 🚀 How to Use ---
1. **Start from basics**: Begin with `01_basics` and work your way up ## 🚀 Getting Started
2. **Run the files**: Each file is executable: `python 01_print.py`
3. **Read the comments**: Each section is thoroughly explained 1. **Clone the repository**
4. **Experiment**: Modify the code and observe the results ```bash
git clone https://github.com/blshaer/python_review.git
cd python_review
```
2. **Start from basics**
```bash
cd 01_basics
python 01_print.py
```
3. **Read the comments** — Each section is thoroughly explained
4. **Experiment** — Modify the code and observe the results
---
## 🛠️ Prerequisites ## 🛠️ Prerequisites
- Python 3.10+ recommended (for match/case support) | Requirement | Version | Notes |
- Python 3.8+ minimum (for most features) |:------------|:--------|:------|
| Python | 3.10+ | Recommended (for match/case support) |
| Python | 3.8+ | Minimum (for most features) |
## 📝 File Structure ```bash
# Check your Python version
python --version
```
---
## <20> File Structure
Each Python file follows a consistent structure:
Each file follows this structure:
```python ```python
""" """
================================================================================ ================================================================================
@ -110,21 +175,89 @@ Key Concepts:
================================================================================ ================================================================================
""" """
# -----------------------------------------------------------------------------
# Section 1: Basic Example # Section 1: Basic Example
# -----------------------------------------------------------------------------
# ... code with inline comments ... # ... code with inline comments ...
# -----------------------------------------------------------------------------
# Section 2: Advanced Example # Section 2: Advanced Example
# -----------------------------------------------------------------------------
# ... more code ... # ... more code ...
``` ```
## ✅ Learning Path ---
## 🗺️ Learning Path
<table>
<tr>
<td align="center"><strong>🌱 Beginner</strong></td>
<td align="center"><strong>📈 Intermediate</strong></td>
<td align="center"><strong>🚀 Advanced</strong></td>
<td align="center"><strong>💼 Professional</strong></td>
</tr>
<tr>
<td>
1. [Basics](./01_basics/)
2. [Control Flow](./02_control_flow/)
3. [Loops](./03_loops/)
</td>
<td>
4. [Data Structures](./04_data_structures/)
5. [Functions](./05_functions/)
6. [Modules](./06_modules_packages/)
</td>
<td>
7. [Error Handling](./07_error_handling/)
8. [OOP](./08_oop/)
9. [Advanced Python](./09_advanced_python/)
</td>
<td>
10. [Best Practices](./10_best_practices/)
</td>
</tr>
</table>
``` ```
Beginner: 01_basics → 02_control_flow → 03_loops 📌 Recommended Flow:
Intermediate: 04_data_structures → 05_functions → 06_modules Beginner → 01_basics → 02_control_flow → 03_loops
Advanced: 07_error_handling → 08_oop → 09_advanced Intermediate → 04_data_structures → 05_functions → 06_modules
Professional: 10_best_practices Advanced → 07_error_handling → 08_oop → 09_advanced
Professional → 10_best_practices
``` ```
--- ---
*Happy Learning! 🐍*
## 📊 Progress Tracker
Use this checklist to track your learning progress:
- [ ] **01. Basics** — Print, Comments, Variables, Data Types
- [ ] **02. Control Flow** — If/Else, Elif, Match/Case
- [ ] **03. Loops** — For, While, Break/Continue
- [ ] **04. Data Structures** — Lists, Tuples, Sets, Dictionaries
- [ ] **05. Functions** — Basics, Arguments, Returns, Lambda
- [ ] **06. Modules & Packages** — Imports, Custom Modules
- [ ] **07. Error Handling** — Try/Except, Custom Exceptions
- [ ] **08. OOP** — Classes, Init, Inheritance, Polymorphism
- [ ] **09. Advanced Python** — Comprehensions, Generators, Decorators
- [ ] **10. Best Practices** — PEP8, Type Hints, Virtual Environments
---
<p align="center">
<strong>Happy Learning! 🐍✨</strong>
</p>
<p align="center">
Made with ❤️ by <a href="https://github.com/blshaer">Baraa</a>
</p>