Ad
  • Default User Avatar

    i added the @staticmethod decorator to make things clearer

  • Default User Avatar
  • Default User Avatar

    When using Python class and declaring methods with class scope, you need add @classmethod above the method declaration and add 'cls' to the beginning of method signature. Also remember to put the class name before all the class variables that used inside the given method

    @classmethod

    def from_roman(cls, roman)

  • Default User Avatar

    i have the very same problem as mdczaplicki and i don't get your answer, csc4pg. can you write down, how the definition of functions should look like? i mean, instead of

    def to_roman(self, n):
    def from_roman(self, s):

    is what exactly supposed to be on that lines? and don't tell me that would be spoiler, it's a manner of understanding the quest, you tell me no algorithm by that...

  • Custom User Avatar

    Think about what you are returning, in this case it's an integer, and the tests are trying to call a function

  • Custom User Avatar

    Because you have 'self' as one of the arguments to your methods, it requires an instance of the class to run.
    Additionally, because codewars uses an old version of python, to run static methods, you need to have @staticmethod above your static method definitions