Skip to content

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Python Fundamentals & Manual Implementations

This repository documents my journey of learning Python through practical projects, exercises, and manual implementations of selected Python operations and concepts.

The main goal is deep understanding rather than quick solutions. By implementing common operations manually, I practice understanding the logic, algorithms, data structures, and behavior behind them instead of simply relying on built-in solutions.


📂 Projects

The projects/ directory contains practical Python projects developed while learning and applying Python fundamentals.

1. Command-Line Calculator (projects/calculator.py)

A command-line calculator built to practice Python fundamentals, type parsing, and error handling.

It supports:

  • Basic Operations: Addition, Subtraction, Multiplication, and Division.
  • Additional Operations: Floor Division (//), Modulo (%), Exponentiation (^), and Roots (sqrt).
  • Error Handling: Handles edge cases such as division by zero, invalid mathematical operations (e.g., 0 raised to a negative exponent), and invalid user input.

Note: The calculator uses its own command syntax for some operations. For example, ^ is used as the exponentiation symbol in the user interface, even though Python itself uses ** for exponentiation.

2. To-Do List Manager (projects/to_do_list.py)

A command-line task management application developed as a practical Python project.

It is used to practice:

  • In-memory data management and list manipulation.
  • CRUD operations (Create, Read, Update, Delete) on Python lists.
  • User input validation and command routing (using match-case).
  • Working with custom library functions for sequence manipulation.
  • Building a larger program from smaller, modular components.

3. Rock Paper Scissors (projects/rock_paper_scissors.py)

A command-line Rock Paper Scissors game built to practice:

  • User input handling and validation.
  • Conditional logic and loop control.
  • List indexing and iteration.
  • Pseudo-random number generation using custom library functions.
  • Tracking and updating game state (scores).

🛠️ Custom Library: abobakr_tools

abobakr_tools is a custom Python library created primarily as a learning tool.

The library contains manually implemented functions that reproduce selected Python operations and concepts without directly using the corresponding built-in solution.

The purpose is not to create a better replacement for Python's built-ins, but to understand how similar operations can be implemented and what logic is involved.

Module: core.py

This module contains the foundational functions for input handling, parsing, string manipulation, collection operations, iteration, random number generation, and other basic Python concepts.

Examples include:

  • Input Handling

    • read_integer
    • read_float
    • read_non_numeric_string
  • Manual Parsing

    • string_to_integer
    • string_to_float
  • String Operations

    • trim_string
    • remove_spaces
    • reverse_items
  • Basic Sequence Operations

    • get_sequence_length — counts items without using len().
    • get_sequence_sum — calculates a sum without using sum().
    • generate_sequence — generates a list of numbers without using range().
    • generate_bounded_range — generates a bounded sequence.
  • Collection Conversions

    • to_tuple
    • to_list
    • to_set
    • to_dict
  • Dictionary and Iteration Operations

    • get_dict_pairs — recreates the basic behavior of dict.items().
    • get_indexed_items — recreates the basic behavior of enumerate().
  • Set Operations

    • set_union
    • set_intersection
    • set_difference
    • set_symmetric_difference
  • Zipping Utilities

    • get_shortest_length
    • zip_as_list
    • zip_as_set
  • Random Number Generation

    • calculate_next_seed
    • get_pseudo_random_int
  • Math Helpers

    • calculate_average

Note: Some functions intentionally reproduce functionality that already exists in Python. This is done strictly for educational purposes to understand the underlying mechanics, not for performance or production use.


🎯 Purpose & Philosophy

This repository is primarily a record of my learning process.

The code prioritizes understanding and clarity of logic over performance, brevity, or following advanced Python conventions.

Why Manual Implementations?

Instead of only learning how to use a function, I sometimes implement a simplified version myself to understand the logic behind it.

For example, implementing a function similar to len() helps me practice:

  • Iteration.
  • Counters.
  • Return values.
  • Working with different types of sequences and iterables.
  • Thinking about how an operation can be performed step by step.

The same approach is used when recreating other Python operations such as range(), sum(), enumerate(), dict.items(), and zip().

Why Not Always Use Pythonic Solutions?

Python provides concise and powerful syntax, but concise code can sometimes hide the underlying logic while learning.

During these exercises, I intentionally write more explicit code so that I can focus on understanding what is happening at each step.

This does not mean that manual implementations are better than Python's built-in functions. In real projects, the built-in and standard Python solutions should normally be preferred for performance and readability.

Learning Through Reimplementation

The library is gradually expanded as I learn new Python concepts and operations.

When I encounter an operation that I already understand well enough to recreate using the concepts I have learned, I may implement a simplified version of it manually.

More advanced operations may be postponed until I have learned the concepts required to implement them properly. This keeps the library connected to my actual learning progress rather than attempting to reproduce Python's functionality all at once.

Future Plan

abobakr_tools is a temporary learning tool.

Once I finish learning the Python fundamentals I am using this library to practice, I plan to stop actively developing the library and move toward writing normal, idiomatic Python code.


🏗️ Project Structure

python-learning/
│
├── abobakr_tools_/                 # Package development directory
│   ├── pyproject.toml              # Package configuration
│   │
│   └── abobakr_tools/              # Actual Python package
│       ├── __init__.py             # Package initialization
│       └── core.py                 # Core utilities and manual implementations
│
└── projects/
    ├── calculator.py
    ├── rock_paper_scissors.py
    └── to_do_list.py

About

Python beginner projects and exercises created while learning Python. Includes CLI projects, practice code, and a custom Python library.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages