Ad
  • Custom User Avatar

    If this is the improved description, I can only imagine how horrible the original description must have been.

  • Custom User Avatar

    Haskell translation

    A language-specific snippet was added to the end of description.

  • Custom User Avatar

    so my indexing doesnt want to work, it says it is incorrect cous it is touple format and i do it as following: pairs[0,0] and it gives me an erroer. any solutions?

  • Custom User Avatar

    I am morally opposed to bare its, fight me :p

    I'll take your word for it that it's all possible situations.

  • Default User Avatar

    Forget, passed after rereading
    Sorry

  • Default User Avatar

    what about now?

  • Default User Avatar

    you're absolutely right, please change that to use sample, there should be no duplicate choices, and then please self-approve that if there's nothing else that's jumping out at you.
    I'm slightly mad about that you wrapped it up in a describe but that's okay.
    the rationale with it is that those are all possible situations, any other combination/permutation one can come up with will be identical but with renamed symbols

  • Custom User Avatar

    This should do what you want in a more concise fashion. I'm not entirely sure what it is you want this for because we're super sleep deprived but the two are equivalent.

  • Custom User Avatar

    I'm pretty sure I can make the permutation generator you wrote nicer as well if you give me a second.

  • Custom User Avatar

    Approved it, but are you sure you wanted to do random.choices(fruit_names, k=7) rather than random.sample(fruit_names, k=7)?

  • Default User Avatar

    I don't hate the task itself though. Mind pressing green button on my fork? Swapped out description, changed to tuples for pairs, fully rewrote tests. Borderline too many random tests but I think I covered all unique cases so I like it that way. I addressed all of points 1 through 5. (stole+edited your solution as reference.. I suppose it's identical to mine. that was the process though xD) Maybe not even a terrible kata after this?

  • Custom User Avatar

    The mismatch is in that the author claims we should test for your point 2, but their own refsol does not test for it and instead considers any set of three completable trades to be valid - ie according the refsol ab,bc,cd is a valid input. They claimed in the discourse that this explicitly was not valid.

    Honestly we should just get this crap retired, it isn't even a good task.

  • Default User Avatar

    Hi

    sorry, but unable tu understand the results of the task "buy" even with the tries of explanation below :

    when you begin with harvested apple and buy orange , have you only orange at this moment or apple+orange in your stock ?

  • Default User Avatar

    For some reason I took a stab at writing a description, it's probably terrible:

    You've harvested a fruit.

    But the Internal Raisin Service (IRS) doesn't allow you to eat your own produce, you have to launder it on the market first.

    When you visit the market, you are given three conversion offers, and for each conversion offer you must decide which direction to trade.

    A conversion offer is a pair of fruits, and to buy the second fruit for the first fruit, the action is "buy"

    The opposite direction is "sell".

    ["apple", "orange"]

    If you have an apple, then you may buy an orange, or, if you have an orange, you may sell it for the apple.

    currently holding: apple
    ["apple", "orange"]
    buy
    currently holding: orange
    ["orange", "pear"]
    buy
    currently holding: pear
    ["apple", "pear"]
    sell
    currently holding: apple (successfully ended up with the same fruit again)
    

    As input you receive three conversion offers and your harvested fruit, and your output is a list of three actions of buy/sell, for the above example the output is: ["buy", "buy", "sell"].

    If it is not possible to end up with the original kind of fruit again after the three conversions, return "ERROR" instead of the list of actions.

  • Default User Avatar

    I don't see the mismatch.. I have some observations though:

    1. the first loop in both with_error and without_error isn't a loop, it only runs once - or if it would loop, then it would be able to return None
    2. there's no test where the final fruit differs from the original one, such as: [['a', 'b'], ['b', 'c'], ['c', 'd']], 'a' with expected an expected outcome of 'ERROR' as d is not a
    3. there's no test where a fruit trades to itself ['a', 'a']
    4. there's no mention of what is considered valid input, yet the solver is asked to test for it
    5. fixing the description involves motivating why the original fruit can't be kept (are we fruit laundering?) and how the words buy/sell correlate to the offer pair even though it's the same action either way. it's missing context.
    6. it has few solves over 7 years

    I don't think the kata deserves to stay listed.

  • Loading more items...