Ad
  • Custom User Avatar

    the sum of the differences of 7 and 1, dude :-)

  • Default User Avatar

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

  • Default User Avatar

    I didn't realize print() returns None. Thank you!

  • Custom User Avatar

    The print() function returns None. You are printing that return value.

    That's because print() has nothing to return; its job is to write the arguments, after converting them to strings, to a file object (which defaults to sys.stdout). But all expressions in Python produce a value, in this case None is produced.

  • Custom User Avatar
  • Default User Avatar

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

  • Default User Avatar

    Are the tests not the same for all?

    The test you claim you're getting does not and can not exist. A js number does not hold any information about leading zeros, it is of your own invention.

  • Custom User Avatar

    This one test did not get passed, so I decided to not go further and see the solution. Surprisingly, other solutions were the same as was mine, so not taking care of the leading 0 case. How come? Are the tests not the same for all?

  • Custom User Avatar

    No, it shouldn't, you're reversing the order, not doing this:

    return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    @lixiang2021 the numbers are guaranteed by the description to be 1 through 9

  • Default User Avatar

    I think the answer is wrong, even though it can pass all tests.

    1. sorted(w) will sort every char in a word by ASCII order increasingly, and it will put digits ahead of letters, ie '0' '1'... '9'..'A'...'Z'..'a'..'z'
    2. asume we ignore consecutive numbers. if the test case is "is2 Thi1s T4est 3a 11h"
      Test.assert_equals(order("is2 Thi1s T4est 3a 11h"), "Thi1s is2 3a T4est 11h")
      And the test result will be '11h Thi1s is2 3a T4est' should equal 'Thi1s is2 3a T4est 11h'. sorted(w) will put '11h' ahead of 'Thi1s', which is not we wanted.
      sorted('11h') -> ['1', '1', 'h']
      sorted('Thi1s') -> ['1', 'T', 'h', 'i', 's']
      and, the second '1' in '11h' is less than 'T' in 'Thi1s', which is not we wanted.
  • Default User Avatar

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

  • Default User Avatar
  • Loading more items...