Ad
  • Custom User Avatar

    Still very much a beginner, so my solutions aren't too compact yet :P

  • Default User Avatar
  • Custom User Avatar

    As a beginner it is amazing to see solutions like this. So much easier than what I did!

  • Custom User Avatar

    Thank you for responding so quickly! I am new to codewars (and coding in general!) and didn't see that replies are collapsed by default, otherwise I would have saw your answer to the same question below. I read through all of the solutions after I complete a Kata but didn't know they could be unlocked prior.

  • Custom User Avatar

    First, what's happening is that your function requires 3 arguments, but it will be called with either 2 or 3 arguments. As in many languages, calling a function with less or more arguments than its required amount will throw an error before anything inside the function runs.

    If it's not clear yet, the tip here is that you need to look up how to make that 3rd argument optional. I'll update the description to provide that tip as well since it may not be clear.

    Keep in mind that you can still unlock the solutions if you want it spoiled. Honestly, I find reading other people's solutions to the same problem as a useful way to learn.

  • Custom User Avatar

    Also tried Python and got a Traceback error:

    TypeError: close_compare() missing 1 required positional argument: 'margin'

    I have tried checking to see if the margin variable is None or "" but the error occurs on the input line before any of the function is executed so that is no help
    I have also googled to see if there is anyway to make the function work without the 3rd argument but I am having no luck figuring it out. Any help would be appreciated!