Ad
  • Custom User Avatar

    When does a sequence ends ? My algorithm finds max until same number is generated second time.
    I pass 20 tests and then fails due my maximum is smaller than expected. Could someone please explain me when method should return maximum value :)

    expected:<615043> but was:<1230086>

  • Custom User Avatar

    Test cases in Python would be better if they were factorized to avoid repetitions. It's easy to create a generic function dotest that does the job for all tests, fixed and random. That would lighten the tests page and would be much more readable. Something like:

    def dotest(n, expected):
      actual = user_function(inputs)
      test.assert_equals(actual, expected, f"Test failed with n = {n}")
      
      # then just do in the tests:
      dotest(n, expected)
    
  • Default User Avatar

    You should add in description that this procedure always generates a cycle.