Interactive Course

Object-Oriented Programming in Python

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

  • 4 hours
  • 13 Videos
  • 45 Exercises
  • 3,289 Participants
  • 3,700 XP

Loved by learners at thousands of top companies:

forrester-grey.svg
intel-grey.svg
whole-foods-grey.svg
dell-grey.svg
credit-suisse-grey.svg
siemens-grey.svg

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!

  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.

  2. 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.

  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.

  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.

  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.

  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.

What do other learners have to say?

Devon

“I've used other sites, but DataCamp's been the one that I've stuck with.”

Devon Edwards Joseph

Lloyd's Banking Group

Louis

“DataCamp is the top resource I recommend for learning data science.”

Louis Maiden

Harvard Business School

Ronbowers

“DataCamp is by far my favorite website to learn from.”

Ronald Bowers

Decision Science Analytics @ USAA

Aliaksandra Yarosh
Aliaksandra Yarosh

Content Quality Analyst @ DataCamp

Alex is a Content Quality Analyst at DataCamp, where they work to ensure that our courses are the best they can be! They have an MS in Applied Mathematics and Computer Science, and a PhD in Theoretical Mathematics. Their favorite things in the world are cats, teaching, and trains.

See More
Collaborators
  • Amy Peterson

    Amy Peterson

  • Maggie Matsui

    Maggie Matsui

Icon Icon Icon professional info