Ad
  • Custom User Avatar

    Hello! Try writing solutions for smaller arrays on paper (Note that there are many solutions). Some of them will help you find the pattern

  • Custom User Avatar

    I can't even solve this with pen and paper. Am I stupid or is this a very difficult one?
    Any hints to get started?

  • Custom User Avatar
  • Custom User Avatar

    count is very inefficient: each time you use it, it needs to parse the whole object it is applied to. There are much better alternatives in Python (make a smart research online and you should find it); there may be other points to enhance or change in your code, though.

    See there to format your code: https://docs.codewars.com/references/markdown/#code-block

  • Custom User Avatar

    Can someone explain why my code times out?

    def find_uniq(arr):
    a = [sorted(set(i.lower())) for i in arr]
    for i in a:
    if a.count(i) == 1:
    return arr[a.index(i)]

    Sorry, I don't know how to make indentation in a comment, but they are correct in my code.

  • Custom User Avatar

    Oh sh*t, yeah, I see what you mean now. Thanks.

  • Custom User Avatar

    Please print the input value with the test result, otherwise you'll never know what's wrong.

    Python Completions 4844

    If a problem with the tests existed, somebody would have noticed before.

    Your code is failing this sample test, you can see the expected answer is ok, your code is wrong:

    test.assert_equals(rot13("@[`{"), "@[`{")
    

    There is no n in the input, your code is returning '@[`n'

  • Custom User Avatar

    Yes, that is correct, but 'z' is 12 letters from 'n'. To get to the 13th letter from 'n', the program has to go back to 'a', or the ASCII value 097. But it seems like the test wants 'n' to be '{' which has the ASCII value 123.

  • Custom User Avatar

    All I can say is the ASCII value for 'z' is 122

  • Custom User Avatar

    I still don't get why my code's translation '@[´a' isn't correct.

  • Custom User Avatar

    The error message is like this: your wrong answer should equal the expected value. To see the input values, print them.

  • Custom User Avatar

    The random tests in python don't even substitute some of the characters. For example it says that something like 'QAnj\nf\nK(´75' should equal 'QA{j\nf\nK(´75'.
    Only one of the characters is changed...

    Another example is: '@[´n' should equal '@[´{'. But in a ROT13 transformation 'n' should equal 'a'.

    The hint says: "For this task you're only supposed to substitue characters. Not spaces, punctuation, numbers etc."

  • Custom User Avatar

    my python returns true, if i do:
    1/5 == 0.2

  • Custom User Avatar

    Because that's how floating point arithmetic work, not only in Python.

    Helper question: how much is 1/5 in Python? Hint: its not 0.2.

  • Custom User Avatar

    Kata only works for perfect squares.

  • Loading more items...