Skip to content

muhammadwali0/python-lab

Repository files navigation

Python Lab

Documenting my journey from basic syntax to Machine Learning, NLP, and beyond.

This repository is a living log of my progress through the Python ecosystem. It tracks my transition from foundational logic to building complex AI models.


Section 0: Setup

  • OS: Omarchy (Arch Linux)
  • Environment: Conda (Virtual Environments)
  • Workflow: Hybrid approach using Neovim for core logic and VS Code for deep debugging and visualization.

Section 1: Basics

  • Syntax & Semantics: Indentation rules, comments, and the Python execution model.
  • Variables: Dynamic memory allocation and naming conventions.
  • Data Types: Working with Strings, Integers, Floats, and Booleans.
  • Operators: Arithmetic, comparison, and logical operator implementation.

Section 2: Control Flow

  • Conditional Statements: Branching logic with if, elif, and else.
  • Loops: Iteration patterns using for (range/sequence) and while.

Section 3: Inbuilt Data Structures

  • Lists: Ordered, mutable sequences for collection management.
  • Tuples: Immutable sequences for fixed data integrity.
  • Sets: Unordered collections of unique elements for membership testing.
  • Dictionaries: Key-value mapping for optimized data retrieval.

Section 4: Functions

  • Getting Started: Defining reusable logic with def, handling arguments (positional vs. keyword), and managing return values.
  • Scope: Understanding Local vs. Global namespaces (LEGB rule).
  • Lambda Functions: Writing anonymous, one-liner functions for quick logic.
  • Functional Tools:
    • Map: Transforming iterables by applying a function to every element.
    • Filter: Extracting elements from a collection based on a boolean condition.
    • Reduce: (via functools) Rolling up a sequence into a single cumulative value.

Section 5: Modules

  • Importing Modules & Packages: Organizing code using import, from ... import, and understanding the difference between a module (.py file) and a package (directory with __init__.py).
  • Standard Library Overview: Leveraging Python’s "batteries included" philosophy with core modules like os, sys, math, and datetime.

Section 6: File Handling

  • File Operations: Mastering the open() function and the with statement (Context Managers) for reading, writing, and appending data safely.
  • Working with File Paths: Navigating filesystems using os.path and the modern pathlib library for cross-platform compatibility.

Section 7: Exception Handling

  • Exception Handling: Building resilient code using try, except, else, and finally blocks to manage runtime errors gracefully.

Section 8: OOPS

  • Classes And Objects: Understanding the blueprint (class) and the instance (object) relationship.
  • Inheritance: Enabling code reuse and hierarchy creation using parent and child classes.
  • Polymorphism: Allowing different classes to be treated as instances of the same general class through method overriding.
  • Encapsulation: Restricting access to internal state using private/protected naming conventions (_ and __).
  • Abstraction: Hiding complex implementation details using Abstract Base Classes (abc module).
  • Magic Methods: Customizing class behavior with "dunder" methods like __init__, __str__, and __repr__.
  • Operator Overloading: Implementing custom arithmetic and comparison logic for objects using magic methods.
  • Custom Exception Handling: Defining domain-specific errors by inheriting from the base Exception class.

More to come...

About

These are all the programs I personally made to go from an absolute beginner to an advanced programmer of Python Progamming Language. This repository will also touch topics like Matplotlib, Machine Learning and NLP in the future.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages