A collection of Python programming exercises for learning through practice. Each problem is documented with clear descriptions in both English and Arabic.
Type System: All solutions use Python Type Hints (Type Annotations) for better code clarity and learning modern Python practices.
مجموعة من تمارين برمجة Python للتعلم من خلال الممارسة. كل مشكلة موثقة بأوصاف واضحة بالإنجليزية والعربية.
نظام الأنواع: جميع الحلول تستخدم تلميحات الأنواع في بايثون (شروح الأنواع) لوضوح الكود وتعلم ممارسات بايثون الحديثة.
learn-python-by-practice/
├── .gitignore # Git ignore file | ملف تجاهل الجيت
├── README.md # Project overview | نظرة عامة على المشروع
├── template.py # Problem template | قالب صياغة المشاكل
└── problems/ # All problems | جميع المشاكل
├── 1_problem_name.py
├── 2_problem_name.py
└── ...
- Python installed (Download)
python --version# Clone the repository | استنساخ المستودع
git clone https://github.com/AbdullahNamespace/learn-python-by-practice.git
cd learn-python-by-practice
# Run a specific problem | تشغيل مشكلة محددة
python problems/1_problem_name.pyAll problems follow a consistent format defined in template.py:
# ════════════════════════════════════════════════════════════════════════════
# ## 🔷 Problem {NUMBER}: {problem_name}.py
# ════════════════════════════════════════════════════════════════════════════
# **Category:** {Category} | {التصنيف}
# **Difficulty:** {Easy/Medium/Hard} | {سهل/متوسط/صعب}
# **Source:** {programmingadvices.com / LeetCode / HackerRank}
# ════════════════════════════════════════════════════════════════════════════
# ────────────────────────────────────────────────────────────────────────────
# 📝 DESCRIPTION | الوصف
# ────────────────────────────────────────────────────────────────────────────
#
# EN:
# {Write clear problem description here}
#
# AR:
# {اكتب وصف المشكلة بوضوح هنا}
#
# ────────────────────────────────────────────────────────────────────────────
# ────────────────────────────────────────────────────────────────────────────
# 💡 EXAMPLES | الأمثلة
# ────────────────────────────────────────────────────────────────────────────
#
# Example 1:
# Input: {sample input}
# Output: {expected output}
# Why: {explanation}
#
# Example 2:
# Input: {sample input}
# Output: {expected output}
# Why: {explanation}
#
# Example 3 (Edge Case):
# Input: {edge case}
# Output: {expected output}
# Why: {explanation}
#
# ────────────────────────────────────────────────────────────────────────────
# ────────────────────────────────────────────────────────────────────────────
# ⚠️ CONSTRAINTS | القيود
# ────────────────────────────────────────────────────────────────────────────
#
# • All functions must use Python Type Hints | يجب استخدام تلميحات الأنواع في جميع الدوال
# • {constraint 1} | {القيد الأول}
# • {constraint 2} | {القيد الثاني}
# • {constraint 3} | {القيد الثالث}
#
# ────────────────────────────────────────────────────────────────────────────
# ────────────────────────────────────────────────────────────────────────────
# 🔧 FUNCTION SIGNATURES | توقيعات الدوال
# ────────────────────────────────────────────────────────────────────────────
#
# def function_name(param: type) -> return_type:
# def helper_function(param: type) -> return_type:
#
# ────────────────────────────────────────────────────────────────────────────Happy Coding! 🐍 | برمجة سعيدة!