Light Mode
Dark Mode
"NotImplementedError: Where is 'Swordsman'?"

I don't know the reason of the error that "NotImplementedError: Where is 'Swordsman'?" Can anyone explain the reason of this error? I attached my code below.

########### Code #############

class EuropeanArmy(Army):
    def train_swordsman(self, name):
        return Knight(name)

    def train_lancer(self, name):
        return Raubritter(name)

    def train_archer(self, name):
        return Ranger(name)

class AsianArmy(Army):
    def train_swordsman(self, name):
        return Samurai(name)

    def train_lancer(self, name):
        return Ronin(name)

    def train_archer(self, name):
        return Shinobi(name)

class Knight(EuropeanArmy):
    def __init__(self, name):
        self.name = name
        self.baseClass = 'European'
        self.basicClass = 'swordsman'

    def introduce(self):
        result = self.__class__.__name__ + ' ' + self.name + ', ' + self.baseClass + ' ' + self.basicClass
        return result

class Raubritter(EuropeanArmy):
    def __init__(self, name):
        self.name = name
        self.baseClass = 'European'
        self.basicClass = 'lancer'

    def introduce(self):
        result = self.__class__.__name__ + ' ' + self.name + ', ' + self.baseClass + ' ' + self.basicClass
        return result

class Ranger(EuropeanArmy):
    def __init__(self, name):
        self.name = name
        self.baseClass = 'European'
        self.basicClass = 'archer'

    def introduce(self):
        result = self.__class__.__name__ + ' ' + self.name + ', ' + self.baseClass + ' ' + self.basicClass
        return result

class Samurai(AsianArmy):
    def __init__(self, name):
        self.name = name
        self.baseClass = 'Asian'
        self.basicClass = 'swordsman'

    def introduce(self):
        result = self.__class__.__name__ + ' ' + self.name + ', ' + self.baseClass + ' ' + self.basicClass
        return result

class Ronin(AsianArmy):
    def __init__(self, name):
        self.name = name
        self.baseClass = 'Asian'
        self.basicClass = 'lancer'

    def introduce(self):
        result = self.__class__.__name__ + ' ' + self.name + ', ' + self.baseClass + ' ' + self.basicClass
        return result

class Shinobi(AsianArmy):
    def __init__(self, name):
        self.name = name
        self.baseClass = 'Asian'
        self.basicClass = 'archer'

    def introduce(self):
        result = self.__class__.__name__ + ' ' + self.name + ', ' + self.baseClass + ' ' + self.basicClass
        return result
Attachment
Created: Aug. 26, 2022, 2:47 a.m.
Updated: Aug. 30, 2022, 1:30 a.m.
1
11
User avatar
hyosik0317