Ad
  • Custom User Avatar

    Sorry, I made some mistakes.

    • Example tests now fixed (hadn't understood the interface correctly).
    • 4 fixed examples added
    • The concept exists in several previous kata, but always requiring understanding of classes, which are not in my students' syllabus.
    • JS was added by the 'Insert example' button, I hadn't intended it. Now deleted.

    Acceptable?

  • Custom User Avatar

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

  • Custom User Avatar

    Most Pythonic solution. Simple, clean, clear, obvious.

  • Custom User Avatar

    This is my first attempt at writing a Kata!

    Q1. How do I separate out the SQL-specific details into the SQL box, and insert Python specific details (ie return a list of dictionaries).

  • Default User Avatar

    Disagree - surely 8byu are about core (basic) functionality? Those things are important, sure, but not for beginners. I send students here who have only been doing Python a few weeks. The sign-up problem is 'someone forgot the return keyword'. My guys can do that. They can (just about) do this with if / returns. But they shouldn't be trying to handle intentionally broken inputs at this early stage.

  • Default User Avatar

    This gives a false positive if name has R or r ANYWHERE in it. Question says only first letter should be checked.

  • Default User Avatar

    The line
    name.lower()
    does nothing

  • Default User Avatar

    0 % 0 evaluates to 0, so the first condition is unnecessary.

  • Default User Avatar

    Yes, it does need at least some of those things, if you're a LEARNER.

    This is a 'clever' problem that has a fun solution, but that's not immediately apparent. 8kyu problems are, I believe, supposed to be for noobs learning their craft. Think back to how difficult it was when 'for / if / str() / etc' were new to you. 8kyu problems should be tightly defined, easily understood practice tasks that highlight some focussed aspect of coding in an approachable way. And there are loads of great 8kyu that fit that description.

    This isn't one of them.

  • Default User Avatar

    I agree, it's fun - but it's not 8kyu

  • Default User Avatar

    This is not an 8kyu question.

    A couple of my students tried it this morning, they're pretty green, but that's what 8kyu questions are for, right? The first part (add digits & subtract from number) is a 8kyu. Basic string/int casting. They worked on it for two hours and gave up in frustration, after tackling obstacle after obstacle. They've done maybe half a dozen 8kyu before but this was far beyond their ability. This morning's session might well be the end of their coding journey.

    This question requires:

    string / int conversion (8kyu)
    chopping up a chunk of text into a dict (7kyu at least)
    recursion (unless you really think about it) (6kyu)
    spotting that the whole thing can be solved using modulo maths. Which most people are unlikely to have studied.

    I recommend this question be regraded - and seriously hope my students don't give up on coding because of it.

  • Custom User Avatar

    More test cases?

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    Aha! I'm working in Python! I tried switching to JS and Ruby and see they have lots of tests! The Python version on has two.

    I have now copied the tests from JS to my Python so I can hopefully see a way forward :)

  • Loading more items...