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
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.
- 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, andraise - Modules, packages, and decorators
- HTTP requests, REST APIs, headers, status codes, and authentication concepts
- Interactive calculators, games, validators, and beginner projects
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.
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.
- Python 3.11 or newer
- Git
- Basic command-line knowledge
git clone https://github.com/AbdulRehman393/python-mastery.git
cd python-mastery# Windows
python -m venv .venv
.venv\Scripts\activate
# macOS/Linux
python3 -m venv .venv
source .venv/bin/activateMost examples use Python's standard library. API examples use requests.
python -m pip install --upgrade pip
python -m pip install -r requirements.txtProject metadata and optional development tools are defined in pyproject.toml.
Run a basic program:
python 01_basics/01_display.pyRun an OOP example:
python 05_oop/01_classes_and_objects/main.pyRun a mini-exercise:
python 09_mini-exercises/17_countdown_timer.pyRun a beginner project:
python 11_projects/beginners/quiz_game.pyRun the PokeAPI example:
python 10_beyond-basics/api.pyThe API example requires an internet connection and the requests package.
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.
The 11_projects/beginners directory currently includes:
concession_stand.pyβ A command-line concession stand programnumber_guessing_game.pyβ A number guessing game with input validationquiz_game.pyβ A multiple-choice Python quiz
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.
- Language: Python 3.11+
- Standard library examples:
math,random,time,string,os, andurllib - External dependency:
requests - Project configuration:
pyproject.toml - License: MIT
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.pyMany scripts are interactive and wait for user input, so they should be run manually rather than executed as a large automated batch.
- β 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
- Complete the file-handling module
- Add learning notes for each major topic
- Implement the
urllibAPI example - Add tests for reusable functions
- Add automated code-quality checks
- Add intermediate projects
- Add SQLite examples
- Explore Pandas and data analysis
- Explore Flask or FastAPI
- Add more API integrations
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.
This project is licensed under the MIT License. See the LICENSE file for details.
Abdul Rehman
- GitHub: @AbdulRehman393
- Repository: python-mastery
If this repository helps you learn Python, consider starring it, sharing it with other learners, or opening an issue with suggestions.
Start with the Basics β’ Try the Exercises β’ Explore the Projects
Built with β€οΈ and lots of β by Abdul Rehman
Last updated: September 19, 2026