Ad
  • Custom User Avatar

    I enjoyed this Kata a lot but I think this is so not an 8 kyu. I would rate it 6 kyu. It may be very discouraging for people who just started to get such kata on the lowest level.

  • Default User Avatar

    Yeah, I gave it clever, since it only loops through the array once to find the answer. The syntax might not be beautiful, but the logic is.

  • Default User Avatar

    How I solved the problem...
    1, Get something printed out. I tried print(players) and variants until print(players[1].name) returned 'b' which looked reasonable.
    2, I tried return players[goose].name, which returned incorrect letters.
    3, So I modified goose to make it return the correct letters... return players[goose-1].name got a few right then returned an out of range error
    4, so I started printing goose so I could see what values were out of range:
      for i in range(30):
        print('{} {}'.format(i, players[i].name))
      return players[goose-1].name
    From the result I found that the players array was 10 characters: abcdcefghz
    5, We're getting in to spoiler territory here, but I realised the value needed to loop over the array, so either the array needs to be multiplied so that it's longer than 'goose' characters, or goose needs to be reduced to a value between 0 and 9.
    6, I hope you enjoy solving the rest yourself.

  • Default User Avatar

    if
    players.length equals 10 and goose equal 30
    then
    30 % 10 == 0, not 10;

  • Default User Avatar

    After I passed the sample tests I got "'circleclutching' should equal 'olliedatabase'" as my first attept failure.
    At the time I thought it was an intentional clue, lol.

  • Default User Avatar

    players has a .name property. I thought part of the fun was that you can't see the property by viewing the list.
    It is there. Try print(players[1].name)

  • Custom User Avatar

    Same here. The test should not be so brittle. A real database would return resutls in ANY order, so should request output be ordered to remove ambiguity and make tests less brittle.

  • Default User Avatar

    Thanks. COUNT will just count the rows with a value in name, two people with the same name will still be both counted. I'd have to test this, but I think COUNT(DISTINCT name) would produce the error you are concerned about.

  • Custom User Avatar

    I think this is a little dangerous because I imagine there could be a situation with two people with the same name?
    Still nice code!

  • Default User Avatar

    Re reply to Miri's comment, wouldn't it make more sense to cast totalamount to money?

  • Default User Avatar

    It would be nice if you included the error, but start by removing the distinct.

  • Default User Avatar

    I agree. The instructions should specify what columns are expected in the final result.

  • Default User Avatar

    I had to remove my "ORDER BY age" to pass the final. The results looked much nicer with it in.