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.
This comment is hidden because it contains spoiler information about the solution
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 returnNone
. In your case, you are returning a boolean value,True
orFalse
. They are values just like numbers and strings, just of another type.If you return the value
True
in a test which expectsFalse
, 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! :-)
a1,a1
:DOh.
I don't need to know what language.
Read your solution again carefully, very, very carefully.
This is not a kata issue.
Please specify a language.
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 thats
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! :-)
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.
You have to watch out for the Python version you use.
default
is an optional parameter appeared in Python 3.4.