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.
Thanks for that (and the link)— I'm a newbie at posting kata of my own so I don't quite know the rules/culture.
Thanks for the feedback, I simplified everything to
champagne
in the description so people don't get confused whether or notwine
is different fromchampagne
. I've keptbottle
in the function name because that is an accurate label, the function is called as each bottle of champagne is doled out one-by-one for poison-testing.This is the same problem, but this kata provides the logical strategy behind discovering the wine bottle. Mine requires you to solve the whole problem, from coming up with the strategy of using minimal rats to suss out the poisoned bottle, all the way to identifying said bottle at the end.
Apologies if that is too similar, but since this version is several steps longer I thought it was justified (and I didn't know about this one beforehand anyway).
Thanks for that, updated the initial provided code to be consistent/correct.
Hey all! Trying to design my first kata, but I think it might not be possible?...
It's a riddle kata... you get
n
items, and one of these items is poisoned. It's your job to find the poisoned item,n_?
out ofn
total. (In addition to severe limitations on how many trials you can do to find it, that's the tricky part.)Now, obviously, the
n_?
item needs to be marked in some way so that when you're experimenting, it can interact with your data objects to give you clues about its identity.But how can I give the kata-goers this variable
n_?
in a secret/hidden fashion without them just saying, well let me just print out the given function parametern_?
and return that, instead of truly 'solving it'?Are kata riddles always this hard/impossible to implement when there needs to be some hidden clue you have access to, but not direct access to?...
(Python, sorry~)
And correct! Stupid of me, but yes I had given the function a third (thought defaulted) input (ans=[]), because I recursed and needed to pass on my accumulating list of squares. Must have screwed up the testing apparatus?
Code could be less clunky, but it works and is submitted now. Ended up just pasting everything in a helper function so I could keep that logic. Will have to fine-tune later.
Thanks!
Issue: my code runs and outputs the exact array as Expected. HOWEVER... in the tests console, I pass test #1, but then for each subsequent test, my output answer is my actual/the real answer (again, tested in Atom and PythonTutor.com) BUT with the previous answer stacked on top of it!
Here is my final console print for each test-- as you can see, each is 'stacked' with the previous test's answer PLUS this test's answer.
SOLUTION!: [3, 2, 1, 1]
SOLUTION!: [3, 2, 1, 1, 3, 2, 1, 1]
SOLUTION!: [3, 2, 1, 1, 3, 2, 1, 1, 14, 6, 6, 2, 2, 2]
(and it continues this indefinitely...)
This issue does not happen in Atom or any other program that I run. Is this a bug on your side? Or is could there be a small error in my code? (though I don't know how my code could save a previous test's answer!!!)
Found the same bug: "See Also" links are pulled by my code, which limit to
Thanks for the help! Don't know if it'll help but I think I understand it more. (Sorry, didn't want to post code, don't know the rules about spoilers...) I'll try it out now though~
This comment is hidden because it contains spoiler information about the solution