🐍 Python Mastery
A structured, hands-on Python learning journey from fundamentals to APIs and beginner projects.

An evolving learning portfolio containing dozens of executable examples, practical exercises, visual references, and beginner-friendly command-line projects.
Getting Started • Learning Path • Exercises • Projects
📋 Overview
python-mastery documents a progressive Python learning journey. The repository begins with syntax and data types, then moves through control flow, collections, functions, loops, object-oriented programming, exception handling, modules, REST APIs, practical exercises, and beginner projects.
The examples are intentionally small and independent so that learners can open a file, read the comments, run it, modify it, and observe the result.
Some modules are complete, while file handling, learning notes, automated tests, and intermediate projects are still being expanded.
🎯 Topics Covered
- Python syntax, variables, data types, and type casting
- User input and formatted output
- Strings, indexing, slicing, and formatting
- Conditional statements and boolean logic
- Lists, sets, tuples, dictionaries, and 2D collections
- Functions, arguments, return values, docstrings, lambdas, and
map()
for, while, and nested loops
- Classes, objects, class variables, inheritance, abstraction, and polymorphism
- Exception handling with
try, except, finally, and raise
- Modules, packages, and decorators
- HTTP requests, REST APIs, headers, status codes, and authentication concepts
- Interactive calculators, games, validators, and beginner projects
📁 Repository Structure
python-mastery/
├── 01_basics/ Python syntax, variables, strings, math, randomness
├── 02_control-flow/ Conditions and boolean logic
├── 03_data_structures/ Lists, sets, tuples, dictionaries, 2D collections
├── 04_functions/ Functions, arguments, docstrings, lambdas, map()
├── 05_oop/ Classes, objects, inheritance, abstraction, polymorphism
├── 06_exception-handling/ try/except/finally and raise
├── 07_file-handling/ Planned file I/O lessons
├── 08_loops/ while, for, and nested loops
├── 09_mini-exercises/ Calculators, games, validators, and utilities
├── 10_beyond-basics/ Modules, packages, decorators, APIs, authentication
├── 11_projects/ Beginner command-line projects
├── 12_notes/ Planned learning notes
├── LICENSE MIT license
├── pyproject.toml Project metadata and tool configuration
├── requirements.txt Runtime dependencies
├── .gitignore Python and IDE ignore rules
└── README.md Project documentation
The repository currently includes 78 Python files across the learning modules, exercises, API lessons, and beginner projects. This number may change as the learning journey grows.
🧭 Learning Path
The recommended order is:
01_basics — Build a foundation with syntax, variables, strings, and math.
02_control-flow — Practice decisions and boolean expressions.
03_data_structures — Learn Python’s core collections.
04_functions — Write reusable and organized code.
08_loops — Practice repetition and iteration.
09_mini-exercises — Apply the concepts to small programs.
05_oop — Learn classes, objects, inheritance, and polymorphism.
06_exception-handling — Handle invalid input and runtime errors.
10_beyond-basics — Explore modules, decorators, APIs, and authentication.
11_projects — Combine your skills in complete beginner programs.
🚀 Getting Started
Prerequisites
- Python 3.11 or newer
- Git
- Basic command-line knowledge
Clone the repository
git clone https://github.com/AbdulRehman393/python-mastery.git
cd python-mastery
Create a virtual environment
# Windows
python -m venv .venv
.venv\Scripts\activate
# macOS/Linux
python3 -m venv .venv
source .venv/bin/activate
Install dependencies
Most examples use Python’s standard library. API examples use requests.
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Project metadata and optional development tools are defined in pyproject.toml.
▶️ Running Examples
Run a basic program:
python 01_basics/01_display.py
Run an OOP example:
python 05_oop/01_classes_and_objects/main.py
Run a mini-exercise:
python 09_mini-exercises/17_countdown_timer.py
Run a beginner project:
python 11_projects/beginners/quiz_game.py
Run the PokeAPI example:
python 10_beyond-basics/api.py
The API example requires an internet connection and the requests package.
💪 Mini-Exercises
The 09_mini-exercises directory contains small programs for practicing concepts such as:
- Mad Libs and interactive storytelling
- Area, circumference, hypotenuse, and compound-interest calculators
- Shopping carts
- Unit and temperature conversion
- Input validation
- Credit-card string slicing
- Countdown timers
- Number guessing
- Phone and email generation
- Password validation
- String concatenation and formatting
These programs are designed to be modified. Try adding validation, functions, tests, or a different user interface to each one.
🧩 Beginner Projects
The 11_projects/beginners directory currently includes:
concession_stand.py — A command-line concession stand program
number_guessing_game.py — A number guessing game with input validation
quiz_game.py — A multiple-choice Python quiz
🌐 API Learning
The 10_beyond-basics directory introduces:
- Python modules and packages
- Decorators
- Basic HTTP requests with
requests
- Query parameters
- HTTP verbs such as GET, POST, PUT, and DELETE
- Request headers
- HTTP status codes
- Basic authentication
- API-key and token authentication concepts
- JSON response handling
The API examples are educational demonstrations. Do not place real passwords, API keys, or tokens directly in source files.
🛠️ Technologies
- Language: Python 3.11+
- Standard library examples:
math, random, time, string, os, and urllib
- External dependency:
requests
- Project configuration:
pyproject.toml
- License: MIT
🧪 Validation
The repository contains standalone learning scripts rather than a formal test suite. You can still verify that the Python files compile:
python -m compileall .
To compile an individual file:
python -m py_compile path/to/example.py
Many scripts are interactive and wait for user input, so they should be run manually rather than executed as a large automated batch.
📊 Progress Tracker
- ✅ Python basics
- ✅ Control flow
- ✅ Data structures
- ✅ Functions
- ✅ Loops
- ✅ Object-oriented programming
- ✅ Exception handling
- ✅ Modules and API fundamentals
- ✅ Beginner projects
- 🔄 File handling
- 🔄 Learning notes
- 🔄 Automated tests
- 🔄 Intermediate projects
🗺️ Roadmap
🤝 Contributing
This is primarily a personal learning repository, but suggestions, corrections, and educational improvements are welcome.
- Fork the repository.
- Create a branch for your change.
- Add or improve an example.
- Run
python -m compileall ..
- Commit your change with a clear message.
- Open a pull request describing what you changed.
Please keep examples beginner-friendly, explain the learning objective, and avoid adding unnecessary dependencies.
📚 Resources
📝 License
This project is licensed under the MIT License. See the LICENSE file for details.
👨💻 Author
Abdul Rehman
⭐ Support
If this repository helps you learn Python, consider starring it, sharing it with other learners, or opening an issue with suggestions.
评论