Skip to content

Repository files navigation

🐍 Python Mastery

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

Python License Status

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:

  1. 01_basics β€” Build a foundation with syntax, variables, strings, and math.
  2. 02_control-flow β€” Practice decisions and boolean expressions.
  3. 03_data_structures β€” Learn Python's core collections.
  4. 04_functions β€” Write reusable and organized code.
  5. 08_loops β€” Practice repetition and iteration.
  6. 09_mini-exercises β€” Apply the concepts to small programs.
  7. 05_oop β€” Learn classes, objects, inheritance, and polymorphism.
  8. 06_exception-handling β€” Handle invalid input and runtime errors.
  9. 10_beyond-basics β€” Explore modules, decorators, APIs, and authentication.
  10. 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

  • Complete the file-handling module
  • Add learning notes for each major topic
  • Implement the urllib API 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

🀝 Contributing

This is primarily a personal learning repository, but suggestions, corrections, and educational improvements are welcome.

  1. Fork the repository.
  2. Create a branch for your change.
  3. Add or improve an example.
  4. Run python -m compileall ..
  5. Commit your change with a clear message.
  6. 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.

πŸš€ Keep Learning, Keep Building

Start with the Basics β€’ Try the Exercises β€’ Explore the Projects


Built with ❀️ and lots of β˜• by Abdul Rehman

Last updated: September 19, 2026

About

A hands-on Python learning journey covering fundamentals, data structures, functions, loops, OOP, exception handling, REST APIs, exercises, and beginner projects.

Topics

Resources

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages