Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
i added the
@staticmethod
decorator to make things clearerYou definetely can return a lambda function. Moreover, you can return lambda function from another lambda function.
can someone explain to me as to why you cant return a lambda function and give me some examples
why use lambda? is this faster or better or what?
Use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
why do you multiplicate "1.0"?
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)
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...
My favorite one
Think about what you are returning, in this case it's an integer, and the tests are trying to call a function
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
TypeError: unbound method to_roman() must be called with RomanNumerals instance as first argument (got int instance instead)
why is that?
I've got:
def to_roman(self, n):
def from_roman(self, s):
no init(self):
what am i doing wrong?
Oh, and I thought I was the only one to think it that way :)!
I did it with a 2 dimensional array, but the rest is quite similar :)
Loading more items...