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.
Not a question, don't post solution in discourse
Also, your code always returns
False
becausetype(max_y/max_x)== float
is always a float, even ifmax_y
is divisible bymax_x
.From the kata description.
I have the same problem with my code. The only difference is the quotation marks.
Your code is wrong: that is nowhere near any of the solutions.
You're not doing that. And why are you doing the input validation inside the loop?
Test.assert_equals
takes two arguments: the value your function returns and the expected value, your function only takes a single argument, see the function definition.From the kata description:
In
[2, 3, 4]
the missing number is 1 and your code doesn't work for that.BTW, when you make a single line code block, there is no need for the python label, use it only when doing a multiline one (single backtick vs triple backticks)
Try keeping the same problem in the same thread, opening more than one is a little messy. Apart of timing out, your code is failing two sample tests, so, first I would try making my code pass the sample test and then I'll try making it faster, because the final tests are really long, note there is a PERFORMANCE tag in this kata. Try using some math.
ah yes, my mistake. the OP had a previous post where the code would sometimes pass. then that code was edited several times, so I've lost track
It's not the indentation, it's the lack of initialization.
Hi @opeth22, your code indentation causes this:
UnboundLocalError: local variable 'answer' referenced before assignment
, so repost your code with the correct indentationSee the quotes in the error messages, your code returns strings instead of numbers.
Yes, only use ```python instead to use Python styles.
I've copied and pasted your code and it worked.
Post your code here using markdown formatting and mark your post as having spoiler content. So I don't have to guess what you're doing ;)
Loading more items...