Skip to main content
HomePythonObject-Oriented Programming in Python

Object-Oriented Programming in Python

4.5+
60 reviews
Advanced

Dive in and learn how to create classes and leverage inheritance and polymorphism to reuse and optimize code.

Start Course for Free
4 Hours13 Videos44 Exercises
77,139 LearnersTrophyStatement of Accomplishment

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

Object-oriented programming (OOP) is a widely used programming paradigm that reduces development times—making it easier to read, reuse, and maintain your code. OOP shifts the focus from thinking about code as a sequence of actions to looking at your program as a collection of objects that interact with each other. In this course, you’ll learn how to create classes, which act as the blueprints for every object in Python. You’ll then leverage principles called inheritance and polymorphism to reuse and optimize code. Dive in and learn how to create beautiful code that’s clean and efficient!
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.

In the following Tracks

Python Developer

Go To Track

Python Programming

Go To Track
  1. 1

    OOP Fundamentals

    Free

    In this chapter, you'll learn what object-oriented programming (OOP) is, how it differs from procedural-programming, and how it can be applied. You'll then define your own classes, and learn how to create methods, attributes, and constructors.

    Play Chapter Now
    What is OOP?
    50 xp
    OOP termininology
    100 xp
    Exploring object interface
    100 xp
    Class anatomy: attributes and methods
    50 xp
    Understanding class definitions
    100 xp
    Create your first class
    100 xp
    Using attributes in class definition
    100 xp
    Class anatomy: the __init__ constructor
    50 xp
    Correct use of __init__
    50 xp
    Add a class constructor
    100 xp
    Write a class from scratch
    100 xp
  2. 2

    Inheritance and Polymorphism

    Inheritance and polymorphism are the core concepts of OOP that enable efficient and consistent code reuse. Learn how to inherit from a class, customize and redefine methods, and review the differences between class-level data and instance-level data.

    Play Chapter Now
  3. 3

    Integrating with Standard Python

    In this chapter, you'll learn how to make sure that objects that store the same data are considered equal, how to define and customize string representations of objects, and even how to create new error types. Through interactive exercises, you’ll learn how to further customize your classes to make them work more like standard Python data types.

    Play Chapter Now
  4. 4

    Best Practices of Class Design

    How do you design classes for inheritance? Does Python have private attributes? Is it possible to control attribute access? You'll find answers to these questions (and more) as you learn class design best practices.

    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

In the following Tracks

Python Developer

Go To Track

Python Programming

Go To Track

Collaborators

Collaborator's avatar
Amy Peterson
Collaborator's avatar
Maggie Matsui

Prerequisites

Writing Functions in Python
Alex Yarosh HeadshotAlex Yarosh

Curriculum Developer @ Cockroach Labs

Alex is a software engineer and mathematician. They currently work at Cockroach Labs - the company behind CockroachDB - where they develop online product trainings. They like cats, teaching, and trains.
See More

Don’t just take our word for it

*4.5
from 60 reviews
75%
12%
10%
3%
0%
Sort by
  • Dalia N.
    7 months

    I finally understand the proper way to build classes and objects was familar before but comfortable now in my programming journey

  • Bob J.
    8 months

    OOP is an essential component of Python programming and key to other key concepts like Error Handling, Custom Class, etc. This is a valuable course with lot of samples and exercises.

  • Oussama B.
    10 months

    great

  • Juan C.
    12 months

    It should be programmed earlier in the learning path

  • Artem K.
    about 1 year

    /

"I finally understand the proper way to build classes and objects was familar before but comfortable now in my programming journey"

Dalia N.

"OOP is an essential component of Python programming and key to other key concepts like Error Handling, Custom Class, etc. This is a valuable course with lot of samples and exercises."

Bob J.

"great"

Oussama B.

FAQs

Join over 13 million learners and start 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.