Coming back to our game example, add a Wizard class to the mix! You can come up with any spells and fighting methods for them, but you need to implement the class correctly.
Abstract classes
You are a wizard!
Report a typo
Write a program in Python 3
from abc import ABC, abstractmethod
class Player(ABC):
def __init__(self, name, rank, level):
self.name = name
self.rank = rank
self.level = level
super().__init__()
@abstractmethod
def fight(self):
...
@abstractmethod
def do_spell(self):
...
def sing_song(self):
print("No songs for me!")
# create a Wizard
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.