Skip to content

MomenBhais/python-oop-tutorial

Repository files navigation

Python Advanced Course - Object-Oriented Programming (OOP) and More

Python Logo

Welcome to this repository, which contains Jupyter Notebooks and PDF files covering advanced topics in the Python programming language, with a focus on Object-Oriented Programming (OOP) and other advanced concepts. The course is divided into sections, each containing detailed explanations with practical examples.

📚 Course Content

Part 1: Object-Oriented Programming (OOP)

1. OOP-1.ipynb

  • Introduction to Object-Oriented Programming (OOP):
    • What is Object-Oriented Programming? Why is it important?
    • Basic concepts: Classes, Objects, Attributes, and Methods.
  • Creating Classes and Objects:
    • How to define classes and create objects.
    • Using the constructor (__init__) to initialize objects.
  • Attributes and Methods:
    • The difference between public and private attributes.
    • How to define methods within classes.
  • Magic Methods:
    • Explanation of magic methods like __str__, __len__, __add__, and more.
    • How to use them to improve code performance.
  • Practical Exercises:
    • Creating a bank account with deposit, withdrawal, and balance display functions.

2. OOP2.ipynb

  • Inheritance:
    • How to create subclasses from base classes.
    • Using super() to access attributes and methods of the parent class.
  • Polymorphism:
    • The concept of polymorphism and how to implement it in Python.
    • Practical examples of polymorphism.
  • Encapsulation:
    • How to use encapsulation to protect data and control access.
    • The difference between public, protected, and private attributes.
  • Getters and Setters:
    • How to use getters and setters to control access to private attributes.
  • Practical Exercises:
    • Creating a library and managing books using OOP.

Part 2: Advanced Concepts

1. Magic Functions

  • Magic Methods:
    • Detailed explanation of magic methods like __init__, __str__, __len__, __add__, and more.
    • How to use them to improve code efficiency.

2. Inheritance

  • Inheritance:
    • How to create subclasses from base classes.
    • Using super() to access attributes and methods of the parent class.
  • Practical Exercises:
    • Creating classes to represent animals using inheritance.

3. Polymorphism

  • Polymorphism:
    • The concept of polymorphism and how to implement it in Python.
    • Practical examples of polymorphism using classes.

4. Encapsulation

  • Encapsulation:
    • How to use encapsulation to protect data and control access.
    • The difference between public, protected, and private attributes.
  • Practical Exercises:
    • Creating classes with encapsulation to control data access.

5. Getters & Setters

  • Getters and Setters:
    • How to use getters and setters to control access to private attributes.
  • Practical Exercises:
    • Creating classes with getters and setters to manage data.

🛠️ How to Use the Files

1. Jupyter Notebooks

  • You can open .ipynb files using Jupyter Notebook or JupyterLab.
  • Each file contains detailed explanations with practical examples that you can run directly.
  • You can modify the code and experiment with it to better understand the concepts.

2. PDF Files

  • The PDF files contain theoretical explanations for each part of the course.
  • You can use them as a quick reference or to review the concepts.
  • You can download and read them on any device that supports PDF files.

📋 Prerequisites

To run the Jupyter Notebooks smoothly, you need the following environment:

  • Python 3.x: You can download Python from the official website.
  • Jupyter Notebook or JupyterLab: You can install it using the following command:
pip install notebook jupyterlab

📚 Additional Resources

If you want to deepen your understanding of Object-Oriented Programming (OOP) in Python, you can check out the following resources:

  1. Object-Oriented Python: Master OOP by Building Games and GUIs

    • This book provides a comprehensive and detailed explanation of Object-Oriented Programming in Python, with practical examples.
    • It is a strong reference for deeply understanding OOP and applying it in real-world projects.
    • The book is authored by Irv Kalb, known for his clear and simplified teaching methods.
    • If you want to master OOP in Python, this book is a must-read and an indispensable reference.
  2. Object-Oriented Python Tutorial by TutorialsPoint

    • This guide from TutorialsPoint provides a simplified and clear explanation of Object-Oriented Programming in Python.
    • It includes practical examples and direct applications to facilitate understanding of basic and advanced OOP concepts.
    • It is an excellent reference for both beginners and advanced learners.
    • If you want a quick start and practical understanding of OOP, this guide is an ideal choice.

📞 Contact

If you have any questions or inquiries, feel free to reach out to me:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published