Contenuti del Corso
Best Practices: Python OOP
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.
Compito
Swipe to start coding
- Create a new
DogClass; - Create two attributes called
nameandbreed.
Once you've completed this task, click the button above the code to check your solution.
Soluzione
Mark tasks as Completed
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 1. Capitolo 2
AVAILABLE TO ULTIMATE ONLY