Ad
  • Custom User Avatar

    Not a question, don't post solution in discourse

  • Custom User Avatar

    Also, your code always returns False because type(max_y/max_x)== float is always a float, even if max_y is divisible by max_x.

  • Custom User Avatar

    If it is zero, it just returns "now".

    From the kata description.

  • Custom User Avatar

    I have the same problem with my code. The only difference is the quotation marks.

  • Custom User Avatar

    Your code is wrong: that is nowhere near any of the solutions.

  • Custom User Avatar

    n being the length of the string array

    You're not doing that. And why are you doing the input validation inside the loop?

  • Custom User Avatar

    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.

    def find_missing_number(number):
    

    From the kata description:

    Write a function that takes a shuffled list of unique numbers from 1 to n with one element missing (which can be any number including n). Return this missing number.

    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)

  • Custom User Avatar

    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.

  • Custom User Avatar

    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

  • Custom User Avatar

    It's not the indentation, it's the lack of initialization.

  • Custom User Avatar

    Hi @opeth22, your code indentation causes this: UnboundLocalError: local variable 'answer' referenced before assignment, so repost your code with the correct indentation

  • Custom User Avatar

    See the quotes in the error messages, your code returns strings instead of numbers.

  • Custom User Avatar

    Yes, only use ```python instead to use Python styles.

  • Custom User Avatar

    I've copied and pasted your code and it worked.

  • Custom User Avatar

    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...