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

Зміст курсу

In-Depth Python OOP

Challenge: AbstractAdmin

Завдання

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.

Завдання

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.

Все було зрозуміло?

Секція 4. Розділ 7
toggle bottom row

Challenge: AbstractAdmin

Завдання

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.

Завдання

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.

Все було зрозуміло?

Секція 4. Розділ 7
toggle bottom row

Challenge: AbstractAdmin

Завдання

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.

Завдання

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.

Все було зрозуміло?

Завдання

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.

Секція 4. Розділ 7
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt