Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I am very sorry if I misunderstand you, but all python functions return a value. If you don't have a return statement, it will return None. In your case, you are returning a boolean value, True or False. They are values just like numbers and strings, just of another type.

    If you return the value True in a test which expects False, the default message for python tests is "Value is not what was expected". So, when you get that value, your function does not pass that test. It does not mean that the test is broken.

    No problem with the formatting, it's easy to forget. In case you didn't know it, you can format your comments like on github: https://help.github.com/categories/writing-on-github/. Formatting code is done with backticks: https://help.github.com/articles/creating-and-highlighting-code-blocks/

    Good luck! :-)

  • Custom User Avatar

    a1,a1 :D

  • Custom User Avatar

    Oh.

    I don't need to know what language.

    Read your solution again carefully, very, very carefully.

    This is not a kata issue.

  • Custom User Avatar

    Please specify a language.

  • Custom User Avatar

    Sorry for taking my time. I have a busy time at work, currently.

    Well, this code does not work. I haven't done very much python, but your reasoning in the code above is easy to follow.

    Your problem is the line if s[-1] and string[index] in normpair or curlypair or squarepair:. It does not do what you intend it to.

    I think you mean if (s[-1] + string[index]) in [normpair, curlypair, squarepair]:.

    Even so, you don't take into account that there may be extra left braces. For example, you return True for '('. You need to check that s is empty in the end.

    Other than that your code works fine for me. (Assuming that you got your indentation correct.)

    Let me know if can still help you with this kata.

    I will remove the issue tag from this question. If you still think there is an issue with this kata, please give me some code that you don't think is working and I'll see what I can do.

    Good luck! :-)

  • Custom User Avatar

    I need a little more information to help you. If you post your code here, or a link to it, I'll see what I can do.

  • Default User Avatar

    You have to watch out for the Python version you use.
    default is an optional parameter appeared in Python 3.4.