Challenge: AbstractAdmin
Opgave
Swipe to start coding
Let's protect your Admin
class structure! You need to define the AbstractAdmin
class that should have the strict Admin
class structure.
- Import the
ABC
class andabstractmethod
decorator from theabc
package. - Define the
AbstractAdmin
class inherited from theABC
class. - Define the abstract methods
login()
,logout()
,create_content()
,update_content()
, anddelete_content()
via the@abstractmethod
decorator.
Use thepass
keyword to miss the function implementation. - Inherit the
Admin
class from theAbstractAdmin
class. - Try to run the code with comments. Look at the Traceback.
- Delete comments in the
Admin
class and run the code again.
Note
Abstract methods should not receive arguments.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 4. Kapitel 7
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Awesome!
Completion rate improved to 2.78
Challenge: AbstractAdmin
Stryg for at vise menuen
Opgave
Swipe to start coding
Let's protect your Admin
class structure! You need to define the AbstractAdmin
class that should have the strict Admin
class structure.
- Import the
ABC
class andabstractmethod
decorator from theabc
package. - Define the
AbstractAdmin
class inherited from theABC
class. - Define the abstract methods
login()
,logout()
,create_content()
,update_content()
, anddelete_content()
via the@abstractmethod
decorator.
Use thepass
keyword to miss the function implementation. - Inherit the
Admin
class from theAbstractAdmin
class. - Try to run the code with comments. Look at the Traceback.
- Delete comments in the
Admin
class and run the code again.
Note
Abstract methods should not receive arguments.
Løsning
Var alt klart?
Tak for dine kommentarer!
Awesome!
Completion rate improved to 2.78Sektion 4. Kapitel 7
single