Skip to main content
HomePythonIntroduction to Object-Oriented Programming in Python

Introduction to Object-Oriented Programming in Python

Discover the fundamental concepts of object-oriented programming (OOP), building custom classes and objects!

Start Course for Free
3 Hours11 Videos37 Exercises

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.
GroupTraining 2 or more people?Try DataCamp For Business

Loved by learners at thousands of companies


Course Description

Foundations of OOP

Delve into the fundamental concepts that form the foundation of object-oriented programming (OOP). You'll discover the core principles of classes and objects, learn how to define and instantiate objectives in Python and explore how to assign attributes during instantiation.

Inheritance

Expand your knowledge by mastering inheritance and creating subclasses that build on functionality defined in other classes. You'll distinguish between class-level and instance-level data, implement class methods, and customize the functionality of subclasses!

Equality, Exception Handling, and Best Practices

Explore the versatility of Python in handling object comparisons and discover techniques for effective string representation of objects, enabling human-readable outputs. Learn how to fortify your code against unexpected errors and enhance its reliability through exception handling. Understand the importance of error detection and graceful error recovery, ensuring a smoother execution of your programs. Acquire best practices for writing clean, maintainable, and Pythonic code that adheres to OOP principles.
For Business

GroupTraining 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more
Try DataCamp for BusinessFor a bespoke solution book a demo.
  1. 1

    OOP Fundamentals

    Free

    Learn what object-oriented programming (OOP) is, how it differs from procedural programming, and how it can be applied. You'll define your own custom classes containing methods, attributes, and constructors, and use them to create objects!

    Play Chapter Now
    What is OOP?
    50 xp
    OOP terminology
    100 xp
    Exploring objects and classes
    100 xp
    Class anatomy: attributes and methods
    50 xp
    Understanding class definitions
    100 xp
    Create your first class
    100 xp
    Adding methods and attributes
    100 xp
    Extending a class
    100 xp
    Class anatomy: the __init__ constructor
    50 xp
    Correct use of __init__
    50 xp
    Add a class constructor
    100 xp
    Building a class from scratch
    100 xp
  2. 3

    Integrating with Standard Python

    Learn how to compare objects, define and customize string representations of objects, and even how to apply inheritance to create and catch custom exceptions, enabling bespoke error-handling.

    Play Chapter Now
For Business

GroupTraining 2 or more people?

Get your team access to the full DataCamp library, with centralized reporting, assignments, projects and more

Collaborators

Collaborator's avatar
Arne Warnke

Prerequisites

Writing Functions in Python
George Boorman HeadshotGeorge Boorman

Curriculum Manager, DataCamp

George is a Curriculum Manager at DataCamp. He holds a PGDip in Exercise for Health and BSc (Hons) in Sports Science and has experience in project management across public health, applied research, and not-for-profit sectors. George is passionate about sports, tech for good, and all things data science.
See More

What do other learners have to say?

Join over 13 million learners and start Introduction to Object-Oriented Programming in Python today!

Create Your Free Account

GoogleLinkedInFacebook

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.