A practical, beginner-friendly Python walkthrough created by Amit K. Jangir.
This repository is a compact learning map for Python fundamentals. Each folder focuses on one concept, with small runnable examples and comments written to explain the idea without overwhelming the reader.
Each concept folder also has its own README.md with the files to run, the main ideas to practice, and useful predefined functions or commands for that topic.
- Variables, constants, and basic printing
- Conditions, if/elif/else, and match statements
- Collections: lists, tuples, sets, and dictionaries
- Loops: for loops, while loops, and comprehensions
- Functions: parameters, return values, lambdas, and closures
- Classes: OOP, inheritance, and polymorphism
- Modules and packages
- Exception handling and custom exceptions
- File I/O and context managers
- Decorators and function wrapping
- Generators and iterators
- Context managers and resource management
- Testing with pytest
- Building APIs with FastAPI
- Creating web applications with Django
.
|-- 1.variables/ # Variables, types, and basic operations
|-- 2.conditions/ # if/elif/else and match statements
|-- 3.collections/ # lists, tuples, sets, dictionaries
|-- 4.loops/ # for loops, while loops, comprehensions
|-- 5.functions/ # functions, lambdas, closures
|-- 6.classes/ # OOP, inheritance, polymorphism
|-- 7.modules/ # imports, packages, __init__.py
|-- 8.exceptions/ # try/except, custom exceptions
|-- 9.file_io/ # reading/writing files, context managers
|-- 10.decorators/ # function decorators, class decorators
|-- 11.generators/ # generators, yield, iterators
|-- 12.context_managers/ # with statement, custom context managers
|-- 13.testing/ # pytest, fixtures, test cases
|-- 14.fastapi_api/ # REST API with FastAPI and jsonplaceholder
|-- 15.django_trello/ # Task management app with Django
`-- README.md # This file
Install Python 3.10 or newer, then clone the repository and run any sample file directly:
python 1.variables/variables.py
python 2.conditions/conditions.py
python 3.collections/lists.py
python 4.loops/loops.py
python 5.functions/functions.pyFor the FastAPI example:
cd 14.fastapi_api
pip install fastapi uvicorn httpx
uvicorn main:app --reloadFor the Django example:
cd 15.django_trello
pip install django
python manage.py migrate
python manage.py runserverFor testing:
cd 13.testing
pip install pytest
pytest -vUse Python 3.10 or newer.
Some examples use modern Python features such as pattern matching (match/case), type hints, and structural pattern matching.
- Start with
1.variables/and2.conditions/. - Move to
3.collections/,4.loops/, and5.functions/. - Learn
6.classes/,7.modules/, and8.exceptions/. - Explore
9.file_io/and12.context_managers/. - Learn
10.decorators/and11.generators/. - Practice
13.testing/for writing tests. - Build APIs with
14.fastapi_api/. - Create web apps with
15.django_trello/.
It's recommended to use virtual environments for Python projects:
# Create a virtual environment
python -m venv venv
# Activate on Windows
venv\Scripts\activate
# Activate on macOS/Linux
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtThe goal is to help new Python learners get a quick but useful overview of the language. The examples are intentionally small, readable, and commented so readers can focus on one concept at a time.
Created and maintained by Amit K. Jangir.
If this repository helps you, consider starring it and sharing it with someone starting their Python journey.