Back to Freecodecamp

Getting Started with Classes

curriculum/challenges/english/blocks/oop-basics/getting-started-with-classes-video.md

latest532 B
Original Source

--description--

In this video, you will learn the basics of OOP by getting started working with classes in Python.

--questions--

--text--

Which of the following is the correct way to add a method to a class?

--answers--

py
class Dog:
    set bark(self):
        print("Woof!")

py
class Dog:
    def bark(self):
        print("Woof!")

py
class Dog:
    method bark(self):
        print("Woof!")

py
class Dog:
    def bark:
        print("Woof!")

--video-solution--

2