Ad
  • Custom User Avatar

    'Much better, yep.

    I don't know why that fixed test was considered missing

    It invalidated my initial solutions.
    About that, you should increase the number of random tests to 250, so that there is slight chance a case like this gets generated during the random tests.

    about test.expect, I didn't know it existed

    The python test framework is described in the docs.

    Cheers


    Edit: when said "fixed tests first", this means the functions that are only related to random tests should be defined after the fixed tests.

  • Custom User Avatar

    Thank you for your feedback,
    I have attempted to make the improvements mentioned and I hope they are suitable.
    thank you for informing me about test.expect, I didn't know it existed.
    I don't know why that fixed test was considered missing, but I will still include it.

  • Custom User Avatar

    Hi,

    The tests need to be rewritten so that the code is maintainable

    • fixed tests first
    • use loops
    • dont declare useless variable you need to hardcode later.
    • use test.expect(check, msg) instead of test.assert_equals, here ok, the process is actually very weird. I'd suggest you return "" in case of success, so that you can do test.expect(not outcome, outcome)
    • the user's fonction should NEVER be called two times for he same test. Store the result, then use it
    • the problem below about input mutation has not been handled completely and still applies: copies of the dictionary must be sent to the user function for the fixed tests also.
    • Missing fixed test: {"blue":16,"red":8,"black":2,"orange":2,"purple":2}
    • The random tests should also generate stuff like this.

    Cheers

  • Custom User Avatar

    thank you, I have edited my tests to use copies of the original dictionary instead of using the original dictionary, which should resolve my mistake

  • Custom User Avatar

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

  • Custom User Avatar

    I just noticed another mistake that was allowing return [] to cause tests to pass, this mistake has been corrected

  • Custom User Avatar

    I made a mistake when creating a test that lead to it always returning true, the test has been fixed, so the random tests should work now

  • Custom User Avatar
  • Custom User Avatar

    this answer doesn't even work it just got lucky that on the attempt there were no instances of the variable having a coefficient of -1 with an even exponent. I fixed the problem in my second submission, just found it funny that this incorrect answer was accepted