Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: AbstractAdmin | Polymorphism and Abstraction
In-Depth Python OOP
course content

Course Content

In-Depth Python OOP

In-Depth Python OOP

1. OOP Concepts
2. Inheritance
3. Encapsulation
4. Polymorphism and Abstraction
5. Magic Methods

book
Challenge: AbstractAdmin

Task
test

Swipe to show code editor

Let's protect your Admin class structure! You need to define the AbstractAdmin class that should have the strict Admin class structure.

  1. Import the ABC class and abstractmethod decorator from the abc package.
  2. Define the AbstractAdmin class inherited from the ABC class.
  3. Define the abstract methods login(), logout(), create_content(), update_content(), and delete_content() via the @abstractmethod decorator.
    Use the pass keyword to miss the function implementation.
  4. Inherit the Admin class from the AbstractAdmin class.
  5. Try to run the code with comments. Look at the Traceback.
  6. Delete comments in the Admin class and run the code again.

Note

Abstract methods should not receive arguments.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 7
toggle bottom row

book
Challenge: AbstractAdmin

Task
test

Swipe to show code editor

Let's protect your Admin class structure! You need to define the AbstractAdmin class that should have the strict Admin class structure.

  1. Import the ABC class and abstractmethod decorator from the abc package.
  2. Define the AbstractAdmin class inherited from the ABC class.
  3. Define the abstract methods login(), logout(), create_content(), update_content(), and delete_content() via the @abstractmethod decorator.
    Use the pass keyword to miss the function implementation.
  4. Inherit the Admin class from the AbstractAdmin class.
  5. Try to run the code with comments. Look at the Traceback.
  6. Delete comments in the Admin class and run the code again.

Note

Abstract methods should not receive arguments.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 4. Chapter 7
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt