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.
@brendanvos
Your own solution also mutates the original list passed trough the function.
Out of curiousity i tried your solution in Pycharm. I stored [1, 1, 1] in a variable x, stored 10 in varuable y, called the function with (x, y) parameters and after requested a print(x). Both the print(function) and print(x) yielded the same result.
That doesn't change anything, because you're using additionnal if/else logic in the loop, on your side. It's like saying that
3*N
is different ofN*3
. Additionally, python being python, the single loop with more code/branching logic is most likely slower than the 3 passes using builtins.Yeah but it's not very efficient as it uses for loops. See my solution. BTW I had initially came up with this solution but I improved before submitting.
It is necessary, for example equal_to_24(55, 26, 30, 5) would give with his solution a "It's not possible!", however 26-((55+5)/30) = 24.
I don't see how you will, even if you skip a solution here, if it exists you'll get it later reordered because of parentheses, but feel free to prove me wrong.
right :) i got a bit lucky apparently
Yes, use other language which handles division by zero without error, like JS which will happily evaluate to
Infinity
:PAs for python how about adding some extra condition to
if
s or if you're bothered by multipletry
s how about using one.Hmmm, why aren't builtin functions pythonic ?
Sorry if I'm mistaken, but aren't you also mutating the input (signature) in your solution?
It doesn't matter if this is an acceptable solution for a beginner. The whole point of "best practice", is that it should be the algorithm/approach that a professional programmer would take on production ready code.
@makis73 Please use spoiler flag next time. It's visible in the homepage otherwise.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
@bcode The exact error message is this:
None should equal 'xakep'
(I guess you're doing it in Python, you didn't say) and it means your code is returningNone
and it should be returning'xakep'
instead.I got tripped up on "www.xakep.ru"... the test returned "None is not equal to xakep". What the heck? Is it expecting "xakep" or None? I tried both but it gives me the same error regardless. I wish I could view the actual test to determine what it is trying to do.
Loading more items...