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.
Because the original language uses class declaration rather than normal function declarations. And the translations follow that pattern, too late to change that as all solutions will be invalidated ...
Why most of the solution are using class?
You don't have to, you could use the fully qualified name instead of using the
Systemnamespace.This comment is hidden because it contains spoiler information about the solution
Approved
Can someone explain to me why i have to import the systems library its getting ridiculouse
In python, the
printfunction actually returnsNone. So, when you doreturn print("blah"), it will print "blah" to stdout, but the value that the function returns isNone. If you want to check for yourself, you can runprint(print("something))and you'll see that it prints"something"and then one line afterwards it printsNone.Tests on codewars do not read stdout, so the tests are blind to anything that you print out. The tests will call your function and use the value that your function returns to the tests. If you're returning
print("whatever"), the only value that the tests ever see isNone.This comment is hidden because it contains spoiler information about the solution
Haskell fork
added
Ah I see, would just a for loop comparing the current value vs lowest known value be less performance expensive or is there some fancy built in python function to do that?
Yes, this is a bad method because sorting is more expensive (i.e. slower and requires more computing power) than other methods, which are also simpler code-wise.
This comment is hidden because it contains spoiler information about the solution
return, not print
return, not print
Loading more items...