Course Content
Best Practices: Python OOP
Swipe to show menu
Creating a Class
In Python, a class is defined using the keyword class
, followed by the class's name. The class definition should include an __init__
method, which serves as the constructor for the class and is invoked upon creating an instance of the class. This method is utilized for initializing the class's attributes.
Task![test](https://cdn.codefinity.com/master/14860d46e0e6ee22ce3b8395724d8dc0016f4a01/_next/static/media/swipe.5f9d7ff8.svg?w=48&q=75)
Swipe to show code editor
- Create a new
Dog
Class; - Create two attributes called
name
andbreed
.
Once you've completed this task, click the button above the code to check your solution.
Mark tasks as Completed
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 2
AVAILABLE TO ULTIMATE ONLY