Skip to content

Latest commit

 

History

History
320 lines (238 loc) · 15.9 KB

File metadata and controls

320 lines (238 loc) · 15.9 KB

Core Python Concepts & Patterns

Python License: MIT

A comprehensive Python learning repository covering everything from fundamentals to advanced patterns, concurrency, cryptography, databases, and interview preparation. Each section contains standalone, runnable examples designed for learning and reference.

Getting Started

# Clone the repository
git clone https://github.com/hassonor/core-python.git
cd core-python

# (Optional) Create a virtual environment
python -m venv .venv
source .venv/bin/activate  # macOS/Linux
# .venv\Scripts\activate   # Windows

# Install dependencies (not all are needed — see requirements.txt for details)
pip install -r requirements.txt

Navigate to any topic directory and run examples directly:

python basic_knowledge/classes/airtravel.py

Table of Contents


Core Python Basics

Foundational Python concepts and built-in data structures.


Classes and Object-Oriented Programming

Deep dive into Python's object model, inheritance, and OOP patterns.


Functions and Functional Programming

Closures, decorators, comprehensions, and functional programming paradigms.


Organizing Larger Programs

Structuring Python projects with packages, modules, and plugins.


Robust Resource and Error Handling

Exception handling, context managers, assertions, and debugging.


Advanced Python

Advanced language features, data handling, and database integration.

Course Material

Language Features

Working with Data

Working with Databases


Async I/O

Asynchronous programming with asyncio and aiohttp.


Parallel and Concurrent Programming

Threading, multiprocessing, synchronization, and concurrency pitfalls.


Cryptography (PyCryptodome)

Practical cryptography examples using the PyCryptodome library.


Book Notes

Study notes and code examples from Python books.

Fluent Python

  • Chapter 1 — The Python Data Model (FrenchDeck, special methods)
  • Chapter 2 — An Array of Sequences (list comprehensions, Vector class)

PyTorch Playground

Machine learning experiments with PyTorch and Jupyter notebooks.


LeetCode Solutions

42 solutions organized by difficulty. Each includes problem description, approach, complexity analysis, and tests. Full list.

Easy (26 problems)

# Problem Approach
1 Two Sum Hash map
9 Palindrome Number Math
20 Valid Parentheses Stack
35 Search Insert Position Binary search
53 Maximum Subarray Kadane's algorithm
67 Add Binary Math
70 Climbing Stairs Dynamic programming
83 Remove Duplicates from Sorted List Linked list
88 Merge Sorted Array Two pointers
118 Pascal's Triangle Dynamic programming
121 Best Time to Buy and Sell Stock One pass
136 Single Number XOR
141 Linked List Cycle Floyd's tortoise & hare
169 Majority Element Boyer-Moore voting
206 Reverse Linked List Iterative pointers
226 Invert Binary Tree Recursion
242 Valid Anagram Character counting

...and more easy problems

Medium (11 problems)

# Problem Approach
3 Longest Substring Without Repeating Characters Sliding window
11 Container With Most Water Two pointers
15 3Sum Sort + two pointers
33 Search in Rotated Sorted Array Modified binary search
36 Valid Sudoku Hash sets
49 Group Anagrams Sorted key hash map
56 Merge Intervals Sort + merge
102 Binary Tree Level Order Traversal BFS
152 Maximum Product Subarray Track min/max
200 Number of Islands DFS flood fill
238 Product of Array Except Self Prefix/suffix products

Hard (5 problems)

# Problem Approach
23 Merge k Sorted Lists Min-heap
42 Trapping Rain Water Two pointers
76 Minimum Window Substring Sliding window
124 Binary Tree Maximum Path Sum DFS
295 Find Median from Data Stream Two heaps

Knowledge and Interview Prep

Interview questions, algorithms, and practical Python knowledge.


Environment Setup


Project Structure

core-python/
├── advanced_python/          # Advanced features, databases, serialization
├── async_io_lib/             # Async/await, asyncio, aiohttp
├── basic_knowledge/          # Python fundamentals
├── book_notes/               # Book study notes (Fluent Python)
├── classes_and_oo/           # Object-oriented programming
├── functions_and_functional_programming/  # Closures, decorators, FP
├── install_steps/            # Environment setup guides
├── knowledge/                # Interview prep, algorithms, LeetCode
├── organizing_larger_programs/  # Packages, modules, plugins
├── parallel_and_concurrent/  # Threading, multiprocessing, locks
├── pycryptodome/             # Cryptography (RSA, AES)
├── pytorch_playground/       # PyTorch experiments
├── robust_resource_and_error_handling/  # Error handling, context managers
├── .cursorrules              # AI coding assistant rules
├── .editorconfig             # Editor configuration
├── .gitignore                # Git ignore rules
├── requirements.txt          # Python dependencies
├── LICENSE                   # MIT License
└── README.md                 # This file

Contributing

Contributions, suggestions, and feedback are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-topic)
  3. Commit your changes (git commit -m 'Add new topic examples')
  4. Push to the branch (git push origin feature/new-topic)
  5. Open a Pull Request

License

This project is licensed under the MIT License — see the LICENSE file for details.


Made with passion by hassonor