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.
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.
How I solved the problem...
1, Get something printed out. I tried
print(players)
and variants untilprint(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 error4, 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.
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.
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)
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.
Re reply to Miri's comment, wouldn't it make more sense to cast totalamount to money?
It would be nice if you included the error, but start by removing the distinct.
I agree. The instructions should specify what columns are expected in the final result.
I had to remove my "ORDER BY age" to pass the final. The results looked much nicer with it in.