हिंदी में भी उपलब्ध: README_HI.md
A structured collection of Python lessons and exercises organized into basic and advanced levels.
This repository is ideal for:
- Self-learners who want a step-by-step guide
- Students in classrooms or coding bootcamps
- Instructors who want ready-to-use lessons and exercises
Each topic is self-contained with example code, so you can run, modify, and experiment without worrying about dependencies.
Exercises come with solutions, allowing you to check your understanding after trying them yourself.
- Start Small – Focus on one lesson at a time.
- Run & Modify Code – Change values, loops, and functions to see what happens.
- Attempt Exercises First – Try solving problems before checking solutions.
- Take Notes – Writing down explanations helps reinforce concepts.
- Revisit Topics – Periodically go back to previous lessons; repetition strengthens understanding.
- Experiment Beyond the Examples – Try small variations, mini-projects, or integrate multiple lessons.
- Use the Exercises Strategically – Stretch challenges are meant to push your problem-solving skills.
Remember: Mastery comes from active practice, not just reading.
- Python 3.8+
- Install packages (if needed) with:
pip install -r requirements.txt| File | Description |
|---|---|
| 01_printing_and_comments.py | Printing text, numbers, multiple items, escape characters, print() options, comments, and docstrings. |
| 02_variables_and_types.py | Variable naming, dynamic typing, common data types, type checking, and type casting. |
| 03_operators.py | Arithmetic, comparison, logical, assignment, membership, and identity operators. |
| 04_input_output.py | Taking input, type conversion, f-strings, .format(), and % formatting. |
| 05_conditionals.py | if/elif/else statements, nested ifs, shorthand if, truthy/falsy values. |
| 06_loops.py | for and while loops, break/continue/pass, nested loops. |
| 07_functions.py | Defining functions, arguments, return values, scope, and lambda functions. |
| 08_collections.py | Lists, tuples, sets, dictionaries, and common operations. |
| 09_strings_in_depth.py | Indexing, slicing, string methods, escape sequences, and f-string formatting. |
| 10_file_handling.py | Reading/writing files, file modes, and context managers. |
| 11_exceptions.py | Try/except blocks, catching specific exceptions, raising exceptions, and finally/else usage. |
| 12_classes_objects.py | Classes, attributes, methods, constructors, self, and simple inheritance. |
| solutions_basic.py | Consolidated solutions and examples from all basic topics. |
| File | Description |
|---|---|
| 01_comprehensions.py | List, dict, set comprehensions and generator expressions. |
| 02_modules_packages.py | Importing built-in modules and creating custom modules/packages. |
| 03_standard_libraries.py | Introduction to math, random, datetime, os, and sys. |
| 04_oop_advanced.py | Advanced OOP: encapsulation, polymorphism, overriding, class vs instance variables. |
| 05_custom_exceptions.py | Raising and handling custom exception classes. |
| 06_virtualenv_pip.py | Creating virtual environments and installing packages with pip. |
| solutions_advanced.py | Consolidated solutions and examples from all advanced topics. |
Each exercise has theory questions, coding tasks, and stretch challenges.
Solutions are provided in matching _solutions.py files.
We welcome contributions from learners, instructors, and developers!
-
Suggest New Lessons or Topics
- Open an issue describing the topic or concept you think should be added.
- Include a brief explanation and any relevant resources.
-
Improve Existing Lessons
- Fix typos, improve explanations, or add better examples.
- Make a pull request (PR) with your improvements.
-
Add Exercises or Projects
- Create practical exercises related to any lesson.
- Include a solution file and make sure it runs correctly.
- Follow the existing naming conventions:
NN_exercises.mdandNN_exercises_solutions.py.
-
Report Bugs or Errors
- If a code snippet doesn’t run or behaves unexpectedly, open an issue.
- Provide the error message and the Python version you used.
-
Code Style and Standards
- Use clear, readable code with proper comments.
- Follow PEP 8 where applicable.
-
Fork & Pull Request Workflow
- Fork the repository
- Make your changes in a new branch
- Submit a PR with a descriptive title and summary
- For more details: Check first-contributions
Your contributions help make this repo better for everyone learning Python!
If you like this repository, motivate us by starring this repo.